Pagini recente » Cod sursa (job #838498) | Cod sursa (job #2580680) | Cod sursa (job #569854) | Cod sursa (job #1449783) | Cod sursa (job #2811174)
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
long long putere(int a, int b, int c) {
if (b == 0) {
return 1 % c;
}
if (b == 1) {
return a % c;
}
if (b % 2 == 0) {
return (putere(a, b/ 2, c) * putere(a, b/ 2, c)) % c;
} else {
return (a * putere(a, b - 1, c)) % c;
}
}
int main() {
long long a, b;
fin >> a >> b;
fout << putere(a, b, 1999999973);
return 0;
}