题解:快速幂模板题
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
LL qmi(LL a, LL b, LL p)
{
LL ans = 1;
while(b)
{
if(b & 1) ans = ans*a%p;
a = a*a%p;
b >>= 1;
}
return ans % p;
}
int main()
{
LL a, b, p;
cin >> a >> b >> p;
cout << qmi(a, b, p);
return 0;
}