Editorial for Tung xúc xắc


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

Author: creator

Với n6 ta có công thức truy hồi:

un=un1+un2+un3+un4+un5+un6.

ui=2i1 với 1i5.

Từ đó ta có thể sử dụng phương pháp nhân ma trận và thuật toán lũy thừa nhanh để tính un trong logn:

[u5u4u3u2u1] [1100010100100101000110000]n = [un+5un+4un+3un+2un+1]


Comments

There are no comments at the moment.