Pagini recente » Cod sursa (job #1639986) | Cod sursa (job #2540902) | Cod sursa (job #2870210) | Cod sursa (job #368228) | Cod sursa (job #2691468)
#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 () {
long long N, P;
fin >> N >> P;
fout << putere(N, P, 1999999973);
}