Pagini recente » Cod sursa (job #1628691) | Cod sursa (job #2298956) | Cod sursa (job #2196454) | Cod sursa (job #1661211) | Cod sursa (job #2225492)
#include <stdio.h>
using namespace std;
const int MOD = 1999999973;
int n,p;
int ridica(int x, int y)
{
if(y < 0) return ridica(1/x,-y) % MOD;
else if(y == 0) return 1;
else if(y == 1) return x;
else if(y & 1) return x * ridica(x*x,(y-1) / 2) % MOD;
else return ridica(x*x,y/2) % MOD;
}
int main()
{
freopen("lgput.in","r",stdin);
freopen("lgput.out","w",stdout);
scanf("%d %d\n",&n,&p);
int x = ridica(n,p);
printf("%d\n", x);
}