Pagini recente » Cod sursa (job #63287) | Cod sursa (job #2089457) | Cod sursa (job #2621107) | Cod sursa (job #3236907) | Cod sursa (job #954187)
Cod sursa(job #954187)
#include<fstream>
using namespace std;
const int diviz=1999999973;
int n,p;
void citire()
{
ifstream fin("lgput.in");
fin>>n>>p;
fin.close();
}
int power(int x,int put)
{
if (put==0)
return 1;
else if (put==1)
return x;
else if (put%2)
return (x*(power(x*x,(put-1)>>1))%diviz)%diviz;
else
return power(x*x,(put>>1))%diviz;
}
void afisare()
{
ofstream fout("lgput.out");
fout<<power(n,p)<<'\n';
fout.close();
}
int main()
{
citire();
afisare();
return 0;
}