Pagini recente » Cod sursa (job #1094750) | Monitorul de evaluare | Cod sursa (job #229544) | Rating Vasile Diana Alexandra (diana_alexandra) | Cod sursa (job #3136559)
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
unsigned long long rec(unsigned long long n, unsigned long long p)
{
if (p == 0)
return 1;
if (p%2 == 0)
return rec((n*n)%1999999973, p/2);
return (n*rec(n, p-1))%1999999973;
}
int main()
{
unsigned long long n, p;
fin >> n >> p;
fout << rec(n, p);
return 0;
}