标签:amp pow 求逆 return for turn mod code ret
LL qpow(LL x,LL y){
LL ans = 1;
for(;y;y>>=1){
if(y&1) ans = (ans*x)%mod;
x = (x*x)%mod;
}
return ans%mod;
}
LL inv(LL x,LL y){ // x/y;
return ( (x%mod)*qpow(y,mod-2)%mod )%mod;
}
标签:amp pow 求逆 return for turn mod code ret
原文地址:https://www.cnblogs.com/Tecode/p/14754928.html