Pagini recente » Cod sursa (job #670105) | Borderou de evaluare (job #2783002) | Cod sursa (job #5017) | Cod sursa (job #1870000) | Cod sursa (job #1800240)
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1999999973;
long long pow(long long x, long long n) {
if (n == 0) return 1;
else if (n == 1) return x % MOD;
else if (n % 2 == 0) {
x *= x;
x %= MOD;
return pow(x, n / 2);
} else {
int xx = x * x;
xx %= MOD;
return (x % MOD) * pow(xx, (n - 1) / 2);
}
}
int main() {
cin.sync_with_stdio(false);
ifstream fin;
ofstream fout;
fin.open("lgput.in");
fout.open("lgput.out");
int N, P; fin >> N >> P;
fout << pow(N, P) << endl;
}