Pagini recente » Cod sursa (job #2071138) | Cod sursa (job #1820091) | Cod sursa (job #433856) | Cod sursa (job #465067) | Cod sursa (job #1325514)
#include <cstdio>
using namespace std;
long long lgexp(long long x,int n)
{
if(n==0) return 1;
else if(n==1) return x;
else if(x%2==0)
return lgexp(x*x,n/2);
else if(x%2!=0)
return x*lgexp(x*x,(n-1)/2);
}
int main()
{
long long x;int n;
freopen("lgput.in","r",stdin);
freopen("lgput.out","w",stdout);
scanf("%I64d%d",&x,&n);
printf("%I64d",lgexp(x,n));
return 0;
}