标签:
#include<stdio.h>
using namespace std;
typedef long long ll;
ll pow_mod(ll a,ll p,ll mod){
ll ans = 1;
while(p > 0){
if(p & 1){
ans = (ans * a) % mod;
}
p >>= 1;
a = (a * a) % mod;
}
return ans;
}
int main(){
ll a,b,mod;
scanf("%lld%lld%lld",&a,&b,&mod);
printf("%lld\n",pow_mod(a,b,mod));
return 0;
}
[2016-05-09][51nod][1046 A^B Mod C]
标签:
原文地址:http://www.cnblogs.com/qhy285571052/p/9a9ded40129492c48cc194fe30a0370d.html