Pagini recente » Borderou de evaluare (job #3000298) | Borderou de evaluare (job #2867382) | Borderou de evaluare (job #2865057) | Cod sursa (job #1032185) | Cod sursa (job #3298158)
#include <stdio.h>
#define MOD 1999999973
unsigned test(unsigned N, unsigned P) {
if (P == 0)
return 1;
if (P % 2)
return N * test(N * N, (P - 1) / 2) % MOD;
return test(N * N, P / 2) % MOD;
}
int main() {
FILE *input = fopen("lgput.in", "r");
FILE *output = fopen("lgput.out", "w");
unsigned N, P;
fscanf(input, "%d %d", &N, &P);
fprintf(output, "%d", test(N, P));
}