long long fast_exp(int base,long long exp,int mod) { long long ans=1LL,a=base; while(exp!=0) { if(exp&1LL) ans*=a,ans%=mod; a*=a,a%=mod; exp>>=1; } return ans%mod; }
long long fast_exp(int base,long long exp,int mod) { long long ans=1LL,a=base; while(exp!=0) { if(exp&1LL) ans*=a,ans%=mod; a*=a,a%=mod; exp>>=1; } return ans%mod; }
转载于:https://www.cnblogs.com/superxuezhazha/p/5767908.html