Pagini recente » Cod sursa (job #3210862) | Cod sursa (job #2626400) | Cod sursa (job #874210) | Cod sursa (job #1988367) | Cod sursa (job #1396410)
#include <fstream>
#include <iostream>
#define modul 1999999973
std::ifstream fin("lgput.in");
std::ofstream fout("lgput.out");
int put(int x, int n) {
long long int res = 1;
long long int a = (long long int) x;
for (int i = 0; (1 << i) <= n; ++i) {
if (((1 << i)&n) > 0) {
res = (res % modul) * a;
res %= modul;
}
a = (a * a) % modul;
}
return res;
}
int main() {
int a, b;
fin >> a >> b;
fout << put(a, b);
return 0;
}