Pagini recente » Cod sursa (job #682830) | Cod sursa (job #2345331) | Cod sursa (job #1072208) | Cod sursa (job #268268) | Cod sursa (job #2752732)
#include <fstream>
#define mod 1999999973
using namespace std;
long long compute_power(long long base, long long exponent) {
if (base == 0) {
return 0;
}
if (exponent == 0) {
return 1;
}
if (exponent % 2) {
return ((base % mod) * (compute_power(base % mod, exponent - 1) % mod)) % mod;
}
if (!(exponent % 2)) {
return (compute_power((base * base) % mod, exponent / 2)) % mod;
}
}
int main() {
ifstream fin("lgput.in");
ofstream fout("lgput.out");
long long n, p;
fin >> n >> p;
fout << compute_power(n, p);
return 0;
}