Pagini recente » Cod sursa (job #3164713) | Cod sursa (job #2444182) | Cod sursa (job #269371) | Cod sursa (job #973057) | Cod sursa (job #2675073)
#include <fstream>
#include <cmath>
using namespace std;
int power(int n,int p)
{
int r=1;
while(p!=0)
{
if(p%2)
return power(1LL * n * n%1999999973, p/2);
else if(p%2!=0)
return 1LL * n * power(1LL*n*n%1999999973,(p-1)/2)%1999999973;
else
return r;
}
}
int main()
{
ifstream fin("lgput.in");
ofstream fout("lgput.out");
int n, p;
fin>>n>>p;
fout<<power(n,p);
return 0;
}