“右移” “与”运算结合 ,遍历b的二进制中的每一位,同时底数a也在每一轮循环中不断更新平方倍
void quic_power(int a, int b ,int mod) { int res=1; for(;b;b>>1) { if(b&1) res =(long long) res * a % mod; a= (long long )a * a % mod; } return res; }