Pagini recente » Diferente pentru runda/2 intre reviziile 3 si 2 | Cod sursa (job #1791250) | Cod sursa (job #745538) | Diferente pentru blog/square-root-trick intre reviziile 35 si 36 | Cod sursa (job #2345607)
#include <iostream>
#include <fstream>
using namespace std;
int x,p;
long long int ans;
int main()
{
ifstream fin("lgput.in");
ofstream fout("lgput.out");
fin>>x>>p;
ans=1;
while (p!=0)
{
if (p%2==0)
{
x=x*x;
p=p/2;
}
else
{
ans=x*ans;
x=x*x;
p=(p-1)/2;
}
}
fout<<ans%1999999973;
return 0;
}