0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-05 02:26:26 +00:00
OI-codes/Hydro/system/H1032/H1032.cpp

22 lines
373 B
C++
Raw Normal View History

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