版本比较
多项式
正文
增加 9 行删除 9 行
83 行未改动848586878888899091923 行未改动9697989910010010110210310416 行未改动12112212312412512512612712812913013013113213313426 行未改动16116216316416516516616716816923 行未改动1931941951961971971981992002017 行未改动20921021121221321321421521621721721821922022165 行未改动28728828929029129129229329429528 行未改动83 行未改动#include<bits/stdc++.h>#define ll long longusing namespace std;const ll maxn=4e5+10, mod=998244353, g=3;ll power(ll a,ll b=mod-2) //1.快速幂 ll power(ll a,ll b=mod-2) //1.快速幂{ ll ans=1; while(b) {3 行未改动 } return ans;}ll r[maxn],tf;void GetRev(ll n) //2.蝴蝶变换预处理 void GetRev(ll n) //2.蝴蝶变换预处理{ if(tf==n) return; tf=n; for(ll i=0;i<n;i++) r[i]=(r[i>>1]>>1)|((i&1)?n>>1:0);16 行未改动 } } }}void px(ll *a,ll *b,ll n) //4.乘法复制 void px(ll *a,ll *b,ll n) //4.乘法复制{ for(ll i=0;i<n;i++) a[i]=a[i]*b[i]%mod;}#define Poly vector<ll>Poly operator + (const Poly &A,const Poly &B) //5.三个运算 Poly operator + (const Poly &A,const Poly &B) //5.三个运算{ Poly C=A; C.resize(max(A.size(),B.size())); for(ll i=0;i<B.size();i++) C[i]=(C[i]+B[i])%mod; return C;26 行未改动 for(ll i=0;i<C.size();i++) C[i]=a[i]*Inv%mod; for(ll i=0;i<n;i++) a[i]=b[i]=0; //attention! return C;}void Getinv(const Poly &A,Poly &B,ll n) //6.求逆 void Getinv(const Poly &A,Poly &B,ll n) //6.求逆{ if(n==1) B.push_back(power(A[0])); else if(n&1) {23 行未改动 inv[1]=1; for(ll i=2;i<=lim;i++) inv[i]=(mod-mod/i)*inv[mod%i]%mod;}Poly dao(const Poly &A) //7.求导与积分 Poly dao(const Poly &A) //7.求导与积分{ Poly C=A; for(ll i=1;i<C.size();i++) C[i-1]=C[i]*i%mod;7 行未改动 C[i]=1ll*C[i-1]*inv[i]%mod; C[0]=0; return C;}Poly ln(const Poly &A) //8.求对数 Poly ln(const Poly &A) //8.求对数{ return jifen(dao(A)*Getinv(A));}void Exp(const Poly &A,Poly &B,ll n) //9.求指数 void Exp(const Poly &A,Poly &B,ll n) //9.求指数{ if(n==1) B.push_back(1); else if(n&1) {65 行未改动上式中形如 $D_R(x)$ 的多项式表示 $D(x)$ 所有系数 reverse 后的多项式。
注意到右边有一项 $x^{n-m+1}Q_R(x)$,当上式在模 $x^{n-m+1}$ 意义下:
$$F_R(x)\equiv P_R(x)G_R(x)\pmod {x^{n-m+1}}$$
$$P_R(x)\equiv \frac{F_R(x)}{G_R(x)}\pmod{x^{n-m+1}}$$
28 行未改动