Pagini recente » Cod sursa (job #1533351) | Cod sursa (job #2498866) | Cod sursa (job #3150163) | Cod sursa (job #2100420) | Cod sursa (job #2959254)
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <iomanip>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
int log_exp(long long a, long long b) {
if (b == 1) {
return a;
}
if (b % 2 == 0) {
long long ok = log_exp(a, b / 2);
//cout << ok * ok << "\n";
return ok * ok;
}
return a * log_exp(a, b - 1);
}
int main() {
long long a, b;
fin >> a >> b;
long long x = log_exp(a, b) % 1999999973;
if (x < 0) {
fout << x * -1;
} else {
fout << x;
}
}