Pagini recente » Cod sursa (job #431501) | Cod sursa (job #524007) | Cod sursa (job #2988058) | Cod sursa (job #2435122) | Cod sursa (job #682499)
Cod sursa(job #682499)
#include <cstdio>
using namespace std;
long long lpow(long long b, long long e)
{
long long rez = 1;
/*
if(e == 0)
rez = 1;
else
{
if(e % 2 == 0)
rez = lpow(b * b % 1999999973, e / 2) % 1999999973;
else
rez = lpow(b * b % 1999999973, e / 2) * b % 1999999973;
}*/
while(e)
{
if(e % 1)
rez = (rez * b) % 1999999973;
e >>= 1;
b = (b * b) % 1999999973;
}
return rez;
}
int main()
{
FILE *in, *out;
in = fopen("lgput.in", "r");
out = fopen("lgput.out", "w");
long long N, P;
fscanf(in, "%lld %lld", &N, &P);
fprintf(out, "%lld", lpow(N, P));
return 0;
}