Pagini recente » Cod sursa (job #3219329) | Cod sursa (job #1128329) | Cod sursa (job #1673575) | Cod sursa (job #1938647) | Cod sursa (job #2057782)
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
int exp_log (int n, int p)
{
if (p == 0)
return 1;
if (p == 1)
return n;
if (p%2 == 0)
return (exp_log(n*n, p/2))%1999999973;
if (p%2 == 1)
return (n*exp_log(n*n, (p-1)/2))%1999999973;
}
int main()
{
int N, P;
fin>>N>>P;
fout<<exp_log(N, P)%1999999973;
}