原理同快速幂
2 * 7 = 2 + 2 * 6
= 2 + 4 * 3
= 2 + 4 + 4 * 2
= 2 + 4 + 8 * 1
#define int long long
int p;
int qmul(int a, int b){
int res = 0;
while(b){
if( b & 1){
res = (res + a) % p;
}
a = a * 2 % p;
b >>= 1;
}
return res;
}