Pagini recente » Cod sursa (job #2803388) | Cod sursa (job #1232697) | Cod sursa (job #2337193) | Cod sursa (job #1594756) | Cod sursa (job #1521515)
#include <stdio.h>
using namespace std;
long long r,x;
int n,p;
int rptl(int p)
{
if(p==1) return n;
if(p==0) return 1;
if(p%2==0)
{
x=rptl(p/2);
r=(x*x)%1999999973;
}
else
{
x=rptl((p-1)/2);
r=(x*x)%1999999973;
r=(r*n)%1999999973;
}
return r;
}
int main()
{
freopen("lgput.in","r",stdin);
freopen("lgput.out","w",stdout);
scanf("%d%d",&n,&p);
x=rptl(p);
printf("%d",x);
return 0;
}