NTT 模板
其实和 $FFT$ 就是一个模子里刻出来的一样, $FFT$ 的优化是基于它的单位根 而 $NTT$ 的模数通常有一个原根, 和 $FFT$ 的单位根有类似的性质 还是存个模板 模板题 #include <iostream> #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAXN 3000010 using namespace std; typedef long long LL; const int mod=998244353; const int g=3; int n,m,rev[MAXN],bit=0,len=1; LL a[MAXN],b[MAXN]; int read(){ int x=0,f=1;char c=getchar(); while(c<'0'||c>'9') {if(c=='-')f=-1;c=getchar();} while(c>='0'&&c<='9') {x=x*10+c-'0';c=getchar();} return x*f; } LL qpow(LL x,LL k){ LL res=1; while(k){ if(k&1) res=res*x%mod; x=x*x%mod; k>>=1; } return res; } void NTT(LL *a,int