Pagini recente » Cod sursa (job #554953) | Profil Anastasia Ștefănescu | Cod sursa (job #2199814) | Diferente pentru runda/fmi-no-stress-9-warmup intre reviziile 18 si 4 | Cod sursa (job #2247758)
#include <iostream>
#include <fstream>
#define rest 1999999973
using namespace std;
unsigned long long n,p,x;
unsigned long long put (unsigned long long a,unsigned long long b)
{
if(b==0)
return 1;
else
if(b==1)
return a%rest;
if(b%2==0)
x=put(a*a%rest,b/2);
else
x=a*put(a*a%rest,(b-1)/2)%rest;
return x;
}
int main()
{
ifstream fin("lgput.in");
ofstream fout("lgput.out");
fin>>n>>p;
fout<<put(n,p);
}