线性常系数齐次递推 - 论如何快速记公式
死记硬背×1
https://www.luogu.org/blog/ShadowassIIXVIIIIV/solution-p4723
给定(k,m),有序列(f)和(g),满足(f(n)=sum_{i=0}^{m-1}f(n-i-1)g(i))。
再给定(f(0),f(1),cdots,f(m-1)),求(f(k))。
(kleq 10^{18},mleq 20000)
设转移矩阵为(A),构造(c)使得(A^k=sum_{i=0}^{m-1}c(i)A^i)
那么(f(k)=sum_{i=0}^{m-1}c(i)f(i))。
(c)的构造:(c=A^nmod G(A))。注意现在多项式的(x)是(A),所以多项式(A=x)
(G)直接记结论:(G=-g^R+x^m)