快速幂

int ppo(int x,int p){
    int t=x,res=1;
    while(p>0){
        if(p&1)res=(res*t)%mod;
        t=(t*t)%mod;
        p>>=1;
    }
    return res%mod;
}
原文地址:https://www.cnblogs.com/yesuweiYYYY/p/13809463.html