【数论】快速乘
2020-06-11 15:34:00 # ACM
1
2
3
4
5
6
7
8
9
#define LL long long
LL qmul(LL a,LL b,LL mod){
LL ans = 0;
for(;b;b>>=1){
if(b&1) ans = (ans+a)%mod;
a = a*2%mod;
}
return ans;
}
Prev
2020-06-11 15:34:00 # ACM
Next