快速幂模板

洛谷模板AC通道

直接上代码:

#define ll long long

ll pow(ll a,ll b){//求a的 b次方 
    ll s = 1,temp = a;
    while(b){
        if(b & 1)s = (s * temp);
        temp = (temp * temp);
        b >>= 1;
    }
    return s;
}

#undef ll
原文地址:https://www.cnblogs.com/wondering-world/p/12945333.html