0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-26 16:12:11 +00:00
OI-codes/AcWing/89/89.cpp

18 lines
271 B
C++
Raw Normal View History

#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;
}