0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-18 07:31:58 +00:00
OI-codes/AcWing/89/89.cpp

18 lines
271 B
C++

#include <bits/stdc++.h>
using namespace std;
long long a, b, p, ans = 1;
int main() {
cin >> a >> b >> p;
a %= p;
while (b) {
if (b & 1) ans = ans * a % p;
a = a * a % p;
b >>= 1;
}
cout << ans % p << endl;
return 0;
}