Pagini recente » Cod sursa (job #2060210) | Cod sursa (job #2830483) | Cod sursa (job #1858292) | Cod sursa (job #1390997) | Cod sursa (job #2223868)
#include <fstream>
#include <string>
#include <algorithm>
#include <tuple>
using namespace std;
const string IN_FILE = "lgput.in";
const string OUT_FILE = "lgput.out";
const int MOD = 1999999973;
int pow(const int value, const int power) {
if (power == 0) return 1;
return power % 2 == 1
? (1LL * value * pow(value, power - 1)) % MOD
: pow((1LL * value * value) % MOD, power / 2);
}
pair<int, int> readInput() {
ifstream in(IN_FILE);
int value, power;
in >> value >> power;
in.close();
return make_pair(value, power);
}
void writeOutput(const int result) {
ofstream out(OUT_FILE);
out << result << "\n";
out.close();
}
int main() {
int value, power;
tie(value, power) = readInput();
const int result = pow(value, power);
writeOutput(result);
return 0;
}