分类: 快速幂

2 篇文章

寒假训练赛 1 的代码
寒假第一场 新年礼物 int n,p[(int)1e5+9],w[(int)1e5+9]; int main() { ios::sync_with_stdio(false); cin.tie(0); cin>>n; f(i,1,n)cin>>p[i]; f(i,1,n)cin>>w[…
多项式快速幂
计算${g(x)}^n \mod p$ int powmod(int a,int b){ int res=1; for(;b>0;b>>=1,a=1ll*a*a%mod)if(b&1)res=1ll*res*a%mod; return res; } void poly_fast(int *a,int b){ lim=1,b…