Pagini recente » Cod sursa (job #412761) | Cod sursa (job #612527) | Cod sursa (job #633427) | Cod sursa (job #2390759) | Cod sursa (job #2043619)
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
int c=1999999973;
long long exp_lg (long long x,long long p)
{
int z;
if (p==1) return x;
if (p==0) return 1;
z=exp_lg(x,p/2);
if (p%2==0) return ((z%c)*(z%c))%c;
else return ((z%c)*(z%c)*(x%c))%c;
}
int main()
{
long long x,p;
fin>>x>>p;
fout<<exp_lg(x,p);
return 0;
}