Pagini recente » Cod sursa (job #976119) | Cod sursa (job #633443) | Cod sursa (job #2404762) | Cod sursa (job #1285070) | Cod sursa (job #2245338)
#include <fstream>
#define llu long long unsigned
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
const llu r=1999999973;
llu lgex(llu x,llu p)
{
if(p==0)return 1;
if(p==1)return x%r;
if(p%2==0)return lgex(x*x%r,p/2);
if(p%2==1)return x*lgex(x*x%r,(p-1)/2)%r;
}
int main()
{
llu a,put;
fin>>a>>put;
fout<<lgex(a,put);
return 0;
}