Pagini recente » Cod sursa (job #1076362) | Cod sursa (job #674115) | Cod sursa (job #467960) | Cod sursa (job #1476210) | Cod sursa (job #2568274)
#include <iostream>
#include <fstream>
using namespace std;
int MOD = 1999999973;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
int lgput(int n, int p) {
int res = 1;
while(p > 0) {
if(p % 2 == 1) {
res = (1LL * res * n) % MOD;
}
p = p/2;
n = (1LL* n*n) % MOD;
}
return res;
}
int main() {
freopen("lgput.in", "r", stdin);
freopen("lgput.out", "w", stdout);
int n, p;
fin >> n >> p;
fout << lgput(n, p);
}