Pagini recente » Cod sursa (job #276227) | Cod sursa (job #300605) | Cod sursa (job #644454) | Cod sursa (job #1960450) | Cod sursa (job #1800261)
#include <iostream>
#include <fstream>
using namespace std;
const long long MOD = 1999999973;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
// long long pow(long long x, long long n) {
// long long y = 1;
// while (n > 1) {
// if (n % 2 == 0) {
// x *= x; x %= MOD; n /= 2;
// } else {
// y *= x; y %= MOD; x *= x; x %= MOD; n = (n - 1) / 2;
// }
// }
// return (x * y) % MOD;
// }
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) return pow((x * x) % MOD, n / 2);
else return (x % MOD) * pow((x * x) % MOD, (n - 1) / 2);
}
int main() {
int N, P; fin >> N >> P;
fout << pow(N, P) << endl;
}