Pagini recente » Istoria paginii runda/delay/clasament | Cod sursa (job #2053921) | Cod sursa (job #1279985) | Cod sursa (job #595825) | Cod sursa (job #1627614)
#include<stdio.h>
using namespace std;
const int R = 1999999973;
int main ()
{
FILE *in, *out;
in = fopen ("lgput.in", "r");
out = fopen ("lgput.out", "w");
long long x, p;
fscanf (in, "%lld%lld", &x, &p);
long long aux = x, aux2 = 1;
while (p > 1)
{
if (p % 2 == 1)
{
aux2 *= aux;
p--;
}
else
{
aux *= aux;
p >>= 1;
}
aux %= R;
aux2 %= R;
}
fprintf (out, "%lld", aux * aux2);
return 0;
}