Pagini recente » Cod sursa (job #1701822) | Cod sursa (job #2546760) | Cod sursa (job #2491234) | Cod sursa (job #1941171) | Cod sursa (job #1118493)
#include <cstdio>
using namespace std;
long long lgput(int a,int b)
{
long long x;
if (b==0) return 1;
if (b==1) return a;
if (a%2)
{
x=lgput(a,(b-1)/2);
x=x*x*a;
}
else
{
x=lgput(a,b/2);
x=x*x;
}
return x;
}
int main()
{
freopen("lgput.in","r",stdin);
freopen("lgput.out","w",stdout);
int n,p;
scanf("%d %d",&n,&p);
long long x=lgput(n,p);
printf("%lld",x);
return 0;
}