前置知识
NTT
多项式取模: 多项式模 x n x^{n} xn 表示取多项式的前 n n n 位
多项式求逆
给定
f ( x ) = a 0 + a 1 x 1 + a 2 x 2 + ⋅ ⋅ ⋅ + a n x n f(x)=a_{0}+a_{1}x^{1}+a_{2}x^{2}+···+a_{n}x^{n} f(x)=a0+a1x1+a2x2+⋅⋅⋅+anxn
求出
g ( x ) = b 0 + b 1 x 1 + b 2 x 2 + ⋅ ⋅ ⋅ + b k x k ( k ≤ n ) g(x)=b_{0}+b_{1}x^{1}+b_{2}x^{2}+···+b_{k}x^{k}\ \ \ (k\le n) g(x)=b0+b1x1+b2x2+⋅⋅⋅+bkxk (k≤n)
使得
f ( x ) g ( x ) ≡ 1 ( m o d x n ) f(x)g(x)\equiv 1\ \ \ (mod\ x^{n}) f(x)g(x)≡1 (mod xn)
做法
当 n = 1 n=1 n=1 时,显然有 b 0 = i n v ( a 0 ) b_{0}=inv(a_{0})