快速幂模板

洛谷模板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

 

posted @ 2020-05-24 00:38  雪之下,树之旁  阅读(119)  评论(0编辑  收藏  举报