Pagini recente » Cod sursa (job #1233775) | Cod sursa (job #2070474) | Cod sursa (job #2285193) | Cod sursa (job #1228835) | Cod sursa (job #682495)
Cod sursa(job #682495)
#include <cstdio>
using namespace std;
long long lpow(int b, int e)
{
long long rez = 1;
if(e == 0)
rez = 1;
else
{
if(e % 2 == 0)
rez = lpow(b * b, e / 2);
else
rez = lpow(b * b, e / 2) * b;
}
return rez;
}
int main()
{
FILE *in, *out;
in = fopen("lgput.in", "r");
out = fopen("lgput.out", "w");
int N, P;
fscanf(in, "%d %d", &N, &P);
fprintf(out, "%lld", lpow(N, P));
return 0;
}