mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-27 14:56:27 +00:00
parent
4c70b1085c
commit
803bd3a891
21
Hydro/H1032/H1032.cpp
Normal file
21
Hydro/H1032/H1032.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user