I should have learned when PO sister came to lecture in March.
But it was more difficult to add oneself lazy, so I qaq.
Now I have to get it over with again.
First, the polynomial asks Ln.
Set g (x) =lnf (x)
We can get the G ' (x) =f ' (x)/F (x) on both sides of the derivative.
then g (x) is the integral of F ' (x)/F (x)
We know that the polynomial derivation and the integral are O (n), the polynomial inversion is O (NLOGN)
So the total time complexity O (NLOGN)
The problem that the polynomial asks Ln generally solves is this
Set the polynomial F to denote something strange, a scheme composed of some strange things in order to
F^1+f^2+f^3 ... A formula for solving the inverse of a polynomial by simplifying the degenerate formula
And by these strange things the disorderly composition of the scheme for
f^1/1!+f^2/2! ......
Unfolded by Taylor we know that after the simplification for e^f
If we know e^f, we need the polynomial to ask Ln for the F.
This derivation is very graceful.
For example, Bzoj 3456 urban Planning
Set the answer to polynomial F, the number of non-direction graphs with n points is a polynomial g
It is not difficult to find that the graph is made up of a number of disordered unicom blocks.
We get the formula G=e^f.
And the polynomial G is very well constructed, F=LN (g)
The polynomial asks Ln to
#include <cstdio> #include <cstring> #include <cstdlib> #include <iostream> #include < Algorithm> #define G 3using namespace std; typedef long LONG ll;const int maxn=300010;const int mod=1004535809;int n,n,len,rev[maxn];int jc[maxn],inv[maxn];int g[ MAXN],F[MAXN],W[MAXN]; int pow_mod (int v,int p) {int tmp=1; while (p) {if (p&1) Tmp=1ll*tmp*v%mod; v=1ll*v*v%mod;p>>=1; }return tmp;} void FFT (int *a,int n,int flag) {for (int i=0;i<n;++i) if (I<rev[i]) swap (a[i],a[rev[i]]); for (int k=2;k<=n;k<<=1) {int mk= (k>>1); int Wn=pow_mod (g,flag==1? ( mod-1)/k: (mod-1)-(mod-1)/k); W[0]=1; for (int i=1;i<mk;++i) W[i]=1ll*w[i-1]*wn%mod; for (int i=0;i<n;i+=k) {for (int j=0;j<mk;++j) {int a=i+j,b=i+j+mk; int x=a[a],y=1ll*a[b]*w[j]%mod; a[a]= (x+y)%mod; A[b]=x-y;if (a[b]<0) a[b]+=mod; }}} if (Flag==-1) { int C=pow_mod (N,MOD-2); for (int i=0;i<n;++i) A[i]=1ll*a[i]*c%mod; }}void GET_INV (int n) {if (n==1) {f[0]=pow_mod (g[0],mod-2); Return } GET_INV (n>>1); int now= (n<<1); for (len=0; (1<<len) <now;++len); for (int i=0;i<now;++i) rev[i]=rev[i>>1]>>1| ((i&1) << (len-1)); static int TMP[MAXN]; for (int i=0;i<n;++i) tmp[i]=g[i]; FFT (tmp,now,1); FFT (f,now,1); for (int i=0;i<now;++i) f[i]=1ll*f[i]* (2ll-1ll*f[i]*tmp[i]%mod+mod)%mod; FFT (f,now,-1); memset (f+n,0,sizeof (int) *n);} void Get_dao () {g[n]=0; for (int i=0;i<n;++i) g[i]=1ll*g[i+1]* (i+1)%mod;} void Get_fen () {f[0]=0; for (int i=n-1;i>=0;--i) f[i]=1ll*f[i-1]*pow_mod (i,mod-2)%mod;} int main () {scanf ("%d", &n); for (n=1; n<=n; N<<=1); Jc[0]=1; for (int i=1;i<n;++i) Jc[i]=1ll*jc[i-1]*i%mod; Inv[n-1]=pow_mod (jc[n-1],mod-2); for (int i=n-2;i>=0;--i) inv[i]=1ll*inv[i+1]* (i+1)%mod; for (int i=0;i<n;++i) {int tmp= (1ll*i* (i-1)/2)% (mod-1); G[i]=1ll*pow_mod (2,tmp) *inv[i]%mod; } GET_INV (N); Get_dao (); n<<=1; for (len=0; (1<<len) <n;++len); for (int i=0;i<n;++i) rev[i]=rev[i>>1]>>1| ((i&1) << (len-1)); FFT (g,n,1); FFT (f,n,1); for (int i=0;i<n;++i) F[i]=1ll*f[i]*g[i]%mod; FFT (f,n,-1); Get_fen (); printf ("%d\n", 1ll*f[n]*jc[n]%mod); return 0;}
Cojs 2358
First, the number of N-point Dags can be obtained by using polynomial inversion, this is no longer a lot to say
It's easy to see that the N-point Dag is made up of several Dag's weakly connected graphs.
The polynomial asks Ln to
#include <cstdio> #include <cstring> #include <iostream> #include <cstdlib> #include < Algorithm> #define G 3using namespace std;const int maxn=300010;const int mod=998244353;int n,n,len,w[maxn];int jc[ Maxn],inv[maxn],rev[maxn];int f[maxn],inv[maxn],ln[maxn];int pow_mod (int v,int p) {int tmp=1;while (p) {if (P&1) TMP =1ll*tmp*v%mod;v=1ll*v*v%mod;p>>=1;} return TMP;} void FFT (int *a,int n,int flag) {for (Int. i=0;i<n;++i) if (I<rev[i]) swap (a[i],a[rev[i]]); for (int k=2;k<=n;k< <=1) {int mk= (k>>1); int Wn=pow_mod (g,flag==1? ( mod-1)/k: (mod-1)-(mod-1)/k); w[0]=1;for (int i=1;i<mk;++i) w[i]=1ll*w[i-1]*wn%mod;for (int i=0;i<n;i+=k) {for ( int j=0;j<mk;++j) {int a=i+j,b=i+j+mk;int x=a[a],y=1ll*a[b]*w[j]%mod; a[a]= (x+y)%mod; A[b]=x-y;if (a[b]<0) A[b]+=mod;}} if (flag==-1) {int c=pow_mod (n,mod-2); for (int i=0;i<n;++i) A[i]=1ll*a[i]*c%mod;} return;} void Get_dao (int n) {f[n]=0;for (int i=0;i<n;++i) f[i]=1ll*f[i+1]* (i+1)%mod;} void Get_fen (int n) {for (int i=n-1;i>=1;--i) Ln[i]=1ll*ln[i-1]*pow_mod (i,mod-2)%mod;ln[0]=0;} void Get_inv (int n) {if (n==1) {inv[0]=pow_mod (f[0],mod-2); return;} GET_INV (n>>1), int now= (n<<1), for (len=0; (1<<len) <now;++len), for (int i=0;i<now;++i) rev[i]= rev[i>>1]>>1| ((i&1) << (len-1)), static int tmp[maxn];for (int i=0;i<n;++i) tmp[i]=f[i];for (int i=n;i<now;++i) Tmp[i] = 0; FFT (inv,now,1); FFT (tmp,now,1); for (int i=0;i<now;++i) inv[i]=1ll*inv[i]* (2ll-1ll*inv[i]*tmp[i]%mod+mod)%mod; FFT (inv,now,-1); memset (inv+n,0,sizeof (int) *n);} void Get_ln (int n) {int now= (n<<1); for (int i=0;i<n;++i) inv[i]=0; GET_INV (n); Get_dao (n); for (len=0; (1<<len) <now;++len), for (int i=0;i<now;++i) rev[i]=rev[i>>1]>>1| ((i&1) << (len-1)); FFT (inv,now,1); FFT (f,now,1); for (int i=0;i<now;++i) Ln[i]=1ll*inv[i]*f[i]%mod; FFT (ln,now,-1); memset (ln+n,0,sizeof (int) *n); Get_fen (n);} int main () {freopen ("dagiv.in", "R", stdin), Freopen ("Dagiv.out", "w", stdout), scanf ("%d", &n); for (n=1; n<=n; N<<=1); JC[0]=1;for (int i=1;i<n;++i) jc[i]=1ll*jc[i-1]*i%mod;inv[n-1]=pow_mod (jc[n-1],mod-2); for (int i=N-2;i>=0;--i) inv[i]=1ll*inv[i+1]* (i+1)%mod;for (int i=0;i<n;++i) {int tmp= (1ll*i* (i-1)/2)% (mod-1); F[i]=1ll*pow_mod ((mod+1) >>1,tmp) *inv[i]%mod;if (i&1) f[i]=mod-f[i];} GET_INV (N); for (int i=0;i<=n;++i) {int tmp= (1ll*i* (i-1)/2)% (mod-1); F[i]=1ll*inv[i]*pow_mod (2,tmp)%mod*jc[i]%mod ; f[i]=1ll*f[i]*inv[i]%mod;} for (int i=n+1;i<n;++i) f[i]=0; Get_ln (N);p rintf ("%d\n", 1ll*ln[n]*jc[n]%mod); return 0;}
Polynomial seeking Exp
The use is in fact the opposite of the polynomial in ln.
For the g=e^f, let's say we know F, and we need to use the polynomial to find the exp.
The way to find exp by polynomial is to multiply by Newton's iterative method
Set f (x) =e^a (x)
We know if G (F0 (x)) =0 (mod x^n)
We have G (f (x)) =0=g (F0 (x))/0!+g ' (F0 (x))/1!* (f (x)-f0 (x)) (mod x^2n)
We can get an expression of f (x) by converting the equation.
And we know that G (F (x)) =LNF (x)-A (x)
We get f (x) =f0 (x) * (1-lnf0 (x) +a (x)) after being brought into the above arrangement
No brain multiplication can be, every time the multiplication of ln can be, constant huge, but still O (NLOGN)
Should have come out to Cojs topic Qaq but because of his authority dropped Qaq
The bell number of the first n items
Mentioned in the previous article that the bell number can be solved by cdq+fft
But we also mentioned the generation function of the bell number e^ (e^x-1)
We do Taylor unfold to e^x-1, and then the polynomial asks Exp to
#include <cstdio> #include <cstring> #include <iostream> #include <cstdlib> #include < Algorithm> #define G 3using namespace std;const int mod=998244353;const int maxn=300010;int n,n,len,t;int JC[MAXN],INV [Maxn],rev[maxn],w[maxn];int g[maxn],f[maxn],h[maxn],ni[maxn];int Exp[maxn],ln[maxn],inv[maxn];int C[maxn];struct Ask{int N;} Q[maxn];int pow_mod (int v,int p) {int tmp=1;while (p) {if (p&1) tmp=1ll*tmp*v%mod;v=1ll*v*v%mod;p>>=1;} return TMP;} void FFT (int *a,int n,int flag) {for (Int. i=0;i<n;++i) if (I<rev[i]) swap (a[i],a[rev[i]]); for (int k=2;k<=n;k< <=1) {int mk= (k>>1); int Wn=pow_mod (g,flag==1? ( mod-1)/k: (mod-1)-(mod-1)/k); w[0]=1;for (int i=1;i<mk;++i) w[i]=1ll*w[i-1]*wn%mod;for (int i=0;i<n;i+=k) {for ( int j=0;j<mk;++j) {int a=i+j,b=i+j+mk;int x=a[a],y=1ll*a[b]*w[j]%mod; a[a]= (x+y)%mod; A[b]=x-y;if (a[b]<0) A[b]+=mod;}} if (flag==-1) {int c=pow_mod (n,mod-2); for (int i=0;i<n;++i) A[i]=1ll*a[i]*c%mod;} return;} void Get_dao (int n) {f[n]=0;for (int i=0;i≪n;++i) f[i]=1ll*f[i+1]* (i+1)%mod; }void Get_fen (int n) {for (int i=n-1;i>=1;--i) ln[i]=1ll*ln[i-1]*ni[i]%mod;ln[0]=0;} void Get_inv (int n) {if (n==1) {inv[0]=pow_mod (f[0],mod-2); return;} GET_INV (n>>1), int now= (n<<1), for (len=0; (1<<len) <now;++len), for (int i=0;i<now;++i) rev[i]= rev[i>>1]>>1| ((i&1) << (len-1)), static int tmp[maxn];for (int i=0;i<n;++i) tmp[i]=f[i];for (int i=n;i<now;++i) Tmp[i] = 0; FFT (tmp,now,1); FFT (inv,now,1); for (int i=0;i<now;++i) inv[i]=1ll*inv[i]* (2ll-1ll*tmp[i]*inv[i]%mod+mod)%mod; FFT (inv,now,-1); memset (inv+n,0,sizeof (int) *n);} void Get_ln (int n) {int now= (n<<1); for (int i=0;i<n;++i) inv[i]=0; GET_INV (n); Get_dao (n); for (len=0; (1<<len) <now;++len), for (int i=0;i<now;++i) rev[i]=rev[i>>1]>>1| ((i&1) << (len-1)); FFT (inv,now,1); FFT (f,now,1); for (int i=0;i<now;++i) Ln[i]=1ll*f[i]*inv[i]%mod; FFT (ln,now,-1); memset (ln+n,0,sizeof (int) *n); Get_fen (n);} void Get_exp (int n) {if (n==1) {Exp[0]=1;return;} Get_exp(n>>1); int now= (n<<1); for (int i=0;i<n;++i) f[i]=exp[i],h[i]=g[i]; GET_LN (n), for (int i=0;i<now;++i) ln[i]= ((i==0)-ln[i]+h[i]+mod)%mod;for (len=0; (1<<len) <now;++len); (int i=0;i<now;++i) rev[i]=rev[i>>1]>>1| ((i&1) << (len-1)); FFT (exp,now,1); FFT (ln,now,1); for (int i=0;i<now;++i) Exp[i]=1ll*exp[i]*ln[i]%mod; FFT (exp,now,-1); memset (exp+n,0,sizeof (int) *n);} int main () {freopen ("qaq_bell.in", "R", stdin), Freopen ("Qaq_bell.ans", "w", stdout), scanf ("%d", &t); for (int i=1;i <=t;++i) {scanf ("%d", &Q[I].N); N=max (N,Q[I].N);} for (n=1; n<=n; n<<=1); jc[0]=1;ni[0]=ni[1]=1;for (int i=1;i<n;++i) Jc[i]=1ll*jc[i-1]*i%mod;inv[n-1]=pow_mod (Jc[N-1], MOD-2); for (int i=n-2;i>=0;--i) inv[i]=1ll*inv[i+1]* (i+1)%mod;for (int i=2;i<n;++i) ni[i]= (mod-1ll* (mod/i) *ni[ MOD%I]%MOD); for (int i=1;i<n;++i) g[i]=inv[i]; Get_exp (N); for (int i=1;i<=t;++i) {n=q[i].n;printf ("%d\n", 1ll*exp[n]*jc[n]%mod);} return 0;}
Polynomial open-root
The same is the use of multiplication
Set g^2 (x) =f (x) (mod x^n)
We get (g^2 (x)-F (x)) ^2=0 (mod x^2n)
Also available (g^2 (x) +f (x)) ^2=4*g^2 (x) *f (x) (mod x^2n)
i.e. ((g^2 (x) +f (x))/2*g (x)) ^2=f (x) (mod x^2n)
Obviously the stuff inside the brackets is what we ask for, and the solution can be
Note that the premise of a polynomial open root is that a constant term can be opened, but if a constant term is not required to be a full square number in a modal sense
As long as the constant term exists two times the remaining can be, as for the solution can be used to solve the nature of the original root
Bzoj 3625
We set the answer polynomial to f (x)
We get the Generate function F (x) =c (x) f^2 (x) +1
Get C (x) f^2 (x)-F (x) +1=0
F (x) = (1 +or-sqrt (1-4C (x))/2c (x)) =2/(1 +or-sqrt (1-4C (x)))
Since the polynomial inversion requires the inverse of the constant term, it can be determined that the plus sign
After the polynomial open root and then to find the inverse of the formula
#include <cstdio> #include <iostream> #include <algorithm> #include <cstdlib> #include < Cstring> #define G 3using namespace std; const int Maxn=300010;const int mod=998244353;int n,m,x,n,len,c;int f[maxn],rt[maxn],inv[maxn],rev[maxn];int W[MAXN]; void read (int &num) {Num=0;char Ch=getchar (); while (ch< '! ') Ch=getchar (); while (ch>= ' 0 ' &&ch<= ' 9 ') num=num*10+ch-' 0 ', Ch=getchar ();} int pow_mod (int v,int p) {int tmp=1; while (p) {if (p&1) Tmp=1ll*tmp*v%mod; v=1ll*v*v%mod;p>>=1; }return tmp;} void FFT (int *a,int n,int flag) {for (int i=0;i<n;++i) if (I<rev[i]) swap (a[i],a[rev[i]]); for (int k=2;k<=n;k<<=1) {int mk= (k>>1); int Wn=pow_mod (g,flag==1? ( mod-1)/k: (mod-1)-(mod-1)/k); W[0]=1; for (int i=1;i<mk;++i) W[i]=1ll*w[i-1]*wn%mod; for (int i=0;i<n;i+=k) {for (int j=0;j<mk;++j) {int a=i+j,b=i+j+mk; int x=a[a],y=1ll*a[b]*W[j]%mod; a[a]= (x+y)%mod; A[b]=x-y;if (a[b]<0) a[b]+=mod; }}} if (flag==-1) {int c=pow_mod (n,mod-2); for (int i=0;i<n;++i) A[i]=1ll*a[i]*c%mod; }return;} void Get_inv (int n) {if (n==1) {inv[0]=pow_mod (rt[0],mod-2); Return } GET_INV (n>>1); int now= (n<<1); for (len=0; (1<<len) <now;++len); for (int i=0;i<now;++i) rev[i]=rev[i>>1]>>1| ((i&1) << (len-1)); static int TMP[MAXN]; for (int i=0;i<n;++i) tmp[i]=rt[i]; for (int i=n;i<now;++i) tmp[i]=0; FFT (tmp,now,1); FFT (inv,now,1); for (int i=0;i<now;++i) inv[i]=1ll*inv[i]* (2ll-1ll*tmp[i]*inv[i]%mod+mod)%mod; FFT (inv,now,-1); memset (inv+n,0,sizeof (int) *n);} void Get_root (int n) {if (n==1) {Rt[0]=1;return;} Get_root (n>>1); for (int i=0;i<n;++i) inv[i]=0; int now= (n<<1); GET_INV (n); static int TMP[MAXN]; for (int i=0;i<n;++i) tmp[i]=f[i]; for (len=0; (1<<len) <now;++len); for (int i=0;i<now;++i) rev[i]=rev[i>>1]>>1| ((i&1) << (len-1)); FFT (inv,now,1); FFT (tmp,now,1); for (int i=0;i<now;++i) Tmp[i]=1ll*tmp[i]*inv[i]%mod; FFT (tmp,now,-1); for (int i=0;i<n;++i) rt[i]=1ll*c* (rt[i]+tmp[i])%mod;} int main () {read (n); read (m); C= ((mod+1) >>1); for (n=1; n<=m; N<<=1); for (int i=1;i<=n;++i) {read (x); if (x<=m) f[x]++; } for (int i=0;i<n;++i) f[i]= ((i==0) -4*f[i]+mod)%mod; Get_root (N); rt[0]++; for (int i=0;i< (n<<1); ++i) inv[i]=0; GET_INV (N); for (int i=1;i<=m;++i) {printf ("%d\n", (inv[i]<<1)%mod); }return 0;}
Polynomial fast power
Seek F^k (x)
We can do the fast power every time we multiply the elimination number bounds can
But that's not a big thing.
We know F^k (x) =exp (ln (f^k (x))
and ln (f^k (x)) =k*ln (F (x))
We do the polynomial to ln, then the coefficients are multiplied by K and exp is restored.
Time complexity O (NLOGN)
The learning estimate for the polynomial is over, and you might learn some of the problems of using FFT to optimize DP, and to optimize string matching with FFT.
Of course I'll write a summary.
I heard that polynomial has more points interpolation, expand Euclid, LaGrand Day inversion and other ghosts.
Let's get rid of it temporarily.
Finally, I attach the ultimate polynomial template, but also zcg their cancer problem.
Cojs 2189-cho's Super polynomial
#include <cstdio> #include <cstring> #include <algorithm> #include <cstdlib> #include < iostream> #include <cmath> #define G 3using namespace std;const int Maxn=300010;const int Mod=998244353;int n,k,n , C,len;int rev[maxn],w[maxn];int f[maxn],rt[maxn];int inv[maxn],ln[maxn],exp[maxn];int pow_mod (int v,int p) {int tmp=1 ; while (p) {if (p&1) tmp=1ll*tmp*v%mod;v=1ll*v*v%mod;p>>=1;} return TMP;} void FFT (int *a,int n,int flag) {for (Int. i=0;i<n;++i) if (I<rev[i]) swap (a[i],a[rev[i]]); for (int k=2;k<=n;k< <=1) {int mk= (k>>1); int Wn=pow_mod (g,flag==1? ( mod-1)/k: (mod-1)-(mod-1)/k); w[0]=1;for (int i=1;i<mk;++i) w[i]=1ll*w[i-1]*wn%mod;for (int i=0;i<n;i+=k) {for ( int j=0;j<mk;++j) {int a=i+j,b=i+j+mk;int x=a[a],y=1ll*a[b]*w[j]%mod; a[a]= (x+y)%mod; A[b]=x-y;if (a[b]<0) A[b]+=mod;}} if (flag==-1) {int c=pow_mod (n,mod-2); for (int i=0;i<n;++i) A[i]=1ll*a[i]*c%mod;} return;} void Get_fen (int *f,int n) {for (int i=n-1;i>=1;--i) f[i]=1ll*f[i-1]*pow_mod (i,mod-2)%mod;f[0]=0;} void Get_dao (int *f,int n) {f[n]=0;for (int i=0;i<n;++i) f[i]=1ll*f[i+1]* (i+1)%mod;} void Get_inv (int n,int *h) {if (n==1) {inv[0]=pow_mod (h[0],mod-2); return;} GET_INV (n>>1,h); int now= (n<<1); static int tmp[maxn];for (int i=0;i<n;++i) tmp[i]=h[i];for (int i=n;i <now;++i) tmp[i]=0;for (len=0; (1<<len) <now;++len); for (int i=0;i<now;++i) rev[i]=rev[i>>1]> >1| ((i&1) << (len-1)); FFT (tmp,now,1); FFT (inv,now,1); for (int i=0;i<now;++i) inv[i]=1ll*inv[i]* (2ll-1ll*tmp[i]*inv[i]%mod+mod)%mod; FFT (inv,now,-1); memset (inv+n,0,sizeof (int) *n);} void Get_root (int n) {if (n==1) {rt[0]= (int) (sqrt (f[0])); return;} Get_root (n>>1); int now= (n<<1); for (int i=0;i<now;++i) inv[i]=0; GET_INV (n,rt); static int tmp[maxn];for (int i=0;i<n;++i) tmp[i]=f[i];for (int i=n;i<now;++i) tmp[i]=0;for (len=0 ;(1<<len) <now;++len); for (int i=0;i<now;++i) rev[i]=rev[i>>1]>>1| ((i&1) << (len-1)); FFT (tmp,now,1); FFT (inv,now,1); for (int i=0;i<now;++i) Tmp[i]=1ll*tmp[i]*inv[i]%mod; FFT (Tmp,now,-1), for (int i=0;i<n;++i) rt[i]=1ll*c* (rt[i]+tmp[i])%mod;} void Get_ln (int n,int *h) {int now= (n<<1); for (int i=0;i<now;++i) inv[i]=0; GET_INV (N,H); Get_dao (H,n); for (len=0; (1<<len) <now;++len), for (int i=0;i<now;++i) rev[i]=rev[i>>1]>>1| ((i&1) << (len-1)); FFT (h,now,1); FFT (inv,now,1); for (int i=0;i<now;++i) Ln[i]=1ll*h[i]*inv[i]%mod; FFT (ln,now,-1); memset (ln+n,0,sizeof (int) *n); Get_fen (ln,n);} void Get_exp (int n) {if (n==1) {Exp[0]=1;return;} Get_exp (n>>1); int now= (n<<1); static int g[maxn];for (int i=0;i<n;++i) g[i]=exp[i];for (int i=n;i<now ; ++i) g[i]=0; Get_ln (N,g), for (int i=0;i<n;++i) ln[i]= ((i==0)-ln[i]+f[i]+mod)%mod;for (len=0; (1<<len) <now;++len); (int i=0;i<now;++i) rev[i]=rev[i>>1]>>1| ((i&1) << (len-1)); FFT (ln,now,1); FFT (exp,now,1); for (int i=0;i<now;++i) Exp[i]=1ll*exp[i]*ln[i]%mod; FFT (exp,now,-1); memset (exp+n,0,sizeof (int) *n);} int main () {freopen ("polynomial.in", "R", stdin); Freopen ("Polynomial.out", "w", stdout); scanf ("%d", &n); scanf ("%d", &k); C= ((mod+1) >>1); for (int. i=0;i<n;++i) scanf ("%d", &f[i]); for (n=1; n<=n; N<<=1); Get_root (N); for (int i=0;i< (n<<1); ++i) inv[i]=0; GET_INV (N,RT); for (int i=0;i<n;++i) f[i]=inv[i]; Get_fen (F,n); for (int i=n;i<n;++i) f[i]=0; Get_exp (N); for (int i=0;i<n;++i) f[i]=exp[i];for (int i=0;i< (n<<1); ++i) inv[i]=0; GET_INV (n,f); for (int i=0;i<n;++i) f[i]=inv[i];f[0]++; Get_ln (n,f); for (int i=0;i<n;++i) f[i]=ln[i];f[0]++;for (int i=n+1;i< (n<<1); ++i) f[i]=0; Get_ln (n,f); for (int i=0;i<n;++i) f[i]=1ll*k*ln[i]%mod;for (int i=0;i< (n<<1); ++i) exp[i]=0; Get_exp (N); for (int i=1;i<n;++i) printf ("%d", 1ll*exp[i]*i%mod);p rintf ("0\n"); return 0;}
Feel the generative function or something is very fun, very want to find time to learn
But it seems that Noi is of little use (fog
Polynomial seeking ln, exp, root, quick power Learning Summary