Pagini recente » Cod sursa (job #1400834) | Cod sursa (job #2783966) | Cod sursa (job #2385797) | Cod sursa (job #186128) | 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);
}