Pagini recente » Cod sursa (job #2325622) | Cod sursa (job #3171827) | Cod sursa (job #125108) | Cod sursa (job #1965384) | Cod sursa (job #954186)
Cod sursa(job #954186)
#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;
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;
}