感觉以前写的这篇太渣了
贴一个新的
inline ll pow(ll a , ll b , ll p){
ll ans = 1;
while(b){
if(b & 1) ans = (ans*a)%p;
a = (a*a)%p;
b >>= 1;
}
return ans;
}
还可以演变一个快速乘
inline ll mul(ll a , ll b , ll p){
ll ans = 0;
while(b){
if(b & 1) ans = (ans + a)%p;
a = (a + a)%p;
b >>= 1;
}
return ans;
}