题目:
代码:
//快速幂
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;
ll pow_mod(ll a,ll i,ll n)
{
if(i==0) return 1%n;
ll temp=pow_mod(a,i>>1,n);
temp=temp*temp%n;
if(i&1) temp=(ll)temp*a%n;
return temp;
}
int main()
{
ll a,b,c;
while(~scanf("%lld%lld%lld",&a,&b,&c))
{
cout<<pow_mod(a,b,c)<<endl;
}
return 0;
}