Pagini recente » Cod sursa (job #3262564) | Cod sursa (job #961915) | Cod sursa (job #1060514) | Cod sursa (job #3038729) | Cod sursa (job #2296750)
#include<cstdio>
using namespace std;
int lgput(int n, int p)
{
if(p == 0)
return 1;
else
{
if(p & 1)
{
int x = lgput(n, p >> 1);
return ((long long)(((long long)x * x) % 1999999973) * n) %1999999973;
}
else
{
int x = lgput(n, p >> 1);
return ((long long) x * x) % 1999999973;
}
}
}
int main()
{
freopen("lgput.in", "r", stdin);
freopen("lgput.out", "w", stdout);
int n, p;
scanf("%d%d", &n, &p);
printf("%d", lgput(n,p));
return 0;
}