给定整数 x,n,p(1<x,n,p≤109)x,n,p(1<x,n,p\le 10^9)x,n,p(1<x,n,p≤109),求 1+x+x2+⋯+xn(modp)1+x+x^2+\dots+x^n \pmod{p}1+x+x2+⋯+xn(modp)。
有没有不用矩阵快速幂优化 DP 的做法?