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