Pagini recente » Cod sursa (job #203622) | Cod sursa (job #1947196) | Cod sursa (job #1621091) | Cod sursa (job #186331) | Cod sursa (job #583648)
Cod sursa(job #583648)
#include <fstream>
#include <iostream>
using namespace std;
const int modul = 1999999973;
unsigned long long rp(const unsigned long long& x, const unsigned long long& n) {
if(n == 0) return 1;
if(n % 2 == 0) {
unsigned long long p = rp(x, n/2) % 1999999973;
return (p * p) % modul;
}
return ((x % modul) * (rp(x, n-1) % modul)) % modul;
}
int main(void) {
unsigned long long n, p;
// citire
ifstream fin("lgput.in");
fin >> n >> p;
fin.close();
// afisare
ofstream fout("lgput.out");
fout << rp(n, p) % modul;
fout.close();
return 0;
}