Pagini recente » Cod sursa (job #1018575) | Cod sursa (job #428976) | Diferente pentru preoni-2007/runda-3/solutii intre reviziile 23 si 22 | Cod sursa (job #1781356) | Cod sursa (job #2034390)
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("lgput.in");
ofstream g("lgput.out");
const int Mod = 1999999973;
long long Exp(long long x, long long y)
{
if(y == 1) return x;
else if(y % 2 == 0) return Exp(x*x%Mod, y/2)%Mod;
else if(y % 2 != 0) return x * Exp(x*x%Mod, (y-1)/2)%Mod;
}
int main()
{
long long n, p;
f >> n >> p;
if(!p) g << 1;
else
g << Exp(n, p)%Mod;
}