Pagini recente » Cod sursa (job #811698) | Cod sursa (job #959759) | Cod sursa (job #349928) | Istoria paginii runda/nr_reale/clasament | Cod sursa (job #1925958)
#include <iostream>
#include <fstream>
#include <climits>
#include <algorithm>
using namespace std;
ifstream in("lgput.in");
ofstream out("lgput.out");
const long long mod = 1999999973;
long long pw(long long,long long);
int main() {
long long B,E;
in>>B>>E;
out<<pw(B,E);
in.close();out.close();
return 0;
}
long long pw(long long b,long long e) {
b %= mod;
if (e == 0) {
return 1;
}
if (e == 1) {
return b;
}
if (e % 2 == 1) {
return (b * pw(b*b,(e-1)/2)) % mod;
}
if (e % 2 == 0) {
return pw(b*b,e/2) % mod;
}
}