快速幂运算 |
int pow1(int a, int b, int mod) {
int res = 1, base = a;
while (b != 0) {
if (b & 1 != 0)
res = res*base % mod;
base = base * base % mod;
b >>= 1;
}
return res;
}
快速幂运算 |
int pow1(int a, int b, int mod) {
int res = 1, base = a;
while (b != 0) {
if (b & 1 != 0)
res = res*base % mod;
base = base * base % mod;
b >>= 1;
}
return res;
}