Pagini recente » Cod sursa (job #2265426) | Cod sursa (job #1852477) | Cod sursa (job #1355967) | Cod sursa (job #2207874) | Cod sursa (job #2691467)
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
int putere(int a, int b, int c) {
if (b == 0)
return 1;
if (b % 2 != 0)
return (a * putere(a, b - 1, c)) % c;
else {
return ((putere(a, b/2, c) % c) * (putere(a, b/2, c) % c)) % c;
}
}
int main () {
int N, P, c = 1999999973;
fin >> N >> P;
fout << putere(N, P, c);
}