Pagini recente » Cod sursa (job #2575955) | Cod sursa (job #704584) | Cod sursa (job #214510) | Sistem | Cod sursa (job #3357052)
#include <stdio.h>
int explog(int x, int n) {
if (n < 0)
return explog(1 / x, -1 * n);
else if (n == 0)
return 1;
else if (n % 2 == 0)
return explog(x * x, n / 2);
else
return x * explog(x * x, (n - 1) / 2);
}
int main(void) {
FILE *in = fopen("lgput.in", "r");
FILE *out = fopen("lgput.out", "w");
int x;
int n, rst = 1999999973;
fscanf(in, "%d", &x);
fscanf(in, "%d", &n);
fprintf(out,"%d", (explog(x, n))%rst);
return 0;
}