#include <iostream>
using namespace std;
typedef long long LL;
LL quickmod(LL a, LL b, LL c)
{
LL ans=1;
a%=c;
while(b)
{
if(b&1)
ans=(ans*a)%c;
b/=2;
a=(a*a)%c;
}
return ans;
}
int main()
{
LL a,b,c;
while(cin>>a>>b>>c)
{
LL ans=quickmod(a, b, c);
cout<<ans<<endl;
}
return 0;
}
时间: 2024-10-27 03:06:38