关注唐氏 @IceKylin,谢谢大家
QQ:1095793440
To do:
缺省源
//From: ifffer_2137
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using uint=unsigned int;
using ull=unsigned long long;
using pii=pair<int,int>;
#define mkpr make_pair
#define x first
#define y second
#define popcnt __builtin_popcountll
inline int read(){
char ch=getchar();int x=0,w=1;
while(ch<'0'||ch>'9'){if(ch=='-')w=0;ch=getchar();}
while(ch>='0'&&ch<='9')x=x*10+(ch^48),ch=getchar();
return w?x:-x;
}
template<class T1,class T2>inline bool Cmn(T1 &x,T2 y){return y<x?(x=y,1):0;}
template<class T1,class T2>inline bool Cmx(T1 &x,T2 y){return x<y?(x=y,1):0;}
mt19937 rnd(time(NULL));
constexpr int inf=0x3f3f3f3f;
constexpr int maxn=2e5+5;
constexpr int maxm=5e3+5;
constexpr int mod=998244353;
constexpr int base=2137;
constexpr int V=1e9;
constexpr int H=18;
constexpr int W=64;
constexpr int Z=26;
constexpr double eps=1e-9;
inline int Redu(int x){return x-(x>=mod)*mod;}
inline void Add(int &x,int y){x=x+y-(x+y>=mod)*mod;}
inline void _Add(int &x,ll y){x=(x+y)%mod;}
inline void Del(int &x,int y){x=x-y+(x<y)*mod;}
inline void _Del(int &x,ll y){x=(x-y)%mod;x+=(x<0)*mod;}
inline __int128 Mul(ll x,ll y){return (__int128)(x)*y;}
inline int Pow(int a,ll x){if(x<0)x+=mod-1;int s=1;for(;x;x>>=1,a=1ll*a*a%mod)if(x&1)s=1ll*s*a%mod;return s;}
inline int Rnd(int l,int r){return rnd()%(r-l+1)+l;}
bool Mem1;
void Init(){}
void Clear(){}
void Mymain(){
Clear();
}
bool Mem2;
signed main(){
#ifdef LOCAL
assert(freopen("data.in","r",stdin));
assert(freopen("test.out","w",stdout));
#endif
cin.tie(0),cout.tie(0);
Init();int _=1;
while(_--) Mymain();
cerr<<"Time: "<<1000.0*clock()/CLOCKS_PER_SEC<<" ms\n";
cerr<<"Memory: "<<(&Mem1-&Mem2)/1024.0/1024.0<<" MB\n";
return 0;
}快读
namespace FastIO{
static char buf[1000000],*p1=buf,*p2=buf;
#define gc p1==p2&&(p2=(p1=buf)+fread(buf,1,1000000,stdin),p1==p2)?EOF:*p1++;
inline int read() {int res=0,w=0; char c=gc; while (!isdigit(c)) c=gc; while (isdigit(c)) res=(res<<1)+(res<<3)+(c^48),c=gc; if (w) res=-res; return res;}
//inline void write(int x) {static int sta[35],top=0; do {sta[top++]=x%10,x/=10;}while (x); while (top) putchar(sta[--top]+48); putchar('\n');}
inline void write(long long x) {static int sta[50],top=0; do {sta[top++]=x%10,x/=10;}while (x); while (top) putchar(sta[--top]+48); putchar('\n');}
};
using namespace FastIO;Miller-Rabin 素性校验
bool check(int b,int p){
if(pw(b,p-1,p)!=1) return false;
for(int i=(p-1)>>1;!(i&1);i>>=1){
int a=pw(b,i,p);
if(a!=1&&a!=p-1) return false;
if(a==p-1) return true;
}
return true;
}
bool MillerRabin(int p){
if(p<=1) return false;
int base[]={2,3,7,97,19260817};
for(int b:base) if(p==b) return true;
for(int b:base){
if(p%b==0) return false;
if(!check(b,p)) return false;
}
return true;
}多项式模板
namespace Poly{
int t[maxn];
void mul(int *f,int *g,int *h,int n,int m,int k){
for(int i=0;i<=k;i++) t[i]=0;
for(int i=0;i<=n;i++){
for(int j=0;j<=m&&i+j<=k;j++){
_Add(t[i+j],1ll*f[i]*g[j]);
}
}
for(int i=0;i<=k;i++) h[i]=t[i];
}
void inv(int *f,int *g,int n){
t[0]=Pow(f[0],mod-2);
for(int i=1;i<=n;i++){
t[i]=0;
for(int j=0;j<i;j++){
_Del(t[i],1ll*t[j]*f[i-j]);
}
t[i]=1ll*t[i]*t[0]%mod;
}
for(int i=0;i<=n;i++) g[i]=t[i];
}
void ln(int *f,int *g,int n){
t[0]=0;
for(int i=1;i<=n;i++){
t[i]=1ll*i*f[i]%mod;
for(int j=1;j<i;j++){
_Del(t[i],1ll*j*t[j]%mod*f[i-j]);
}
t[i]=1ll*t[i]*Pow(1ll*i*f[0]%mod,mod-2)%mod;
}
for(int i=0;i<=n;i++) g[i]=t[i];
}
void exp(int *f,int *g,int n){
t[0]=1;
for(int i=1;i<=n;i++){
t[i]=0;
for(int j=1;j<=i;j++){
_Add(t[i],1ll*j*f[j]%mod*t[i-j]);
}
t[i]=1ll*t[i]*Pow(i,mod-2)%mod;
}
for(int i=0;i<=n;i++) g[i]=t[i];
}
}






