mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-12 05:26:28 +00:00
18 lines
271 B
C++
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;
|
||
|
}
|