Pagini recente » Sandbox | Cod sursa (job #2663010)
#include <iostream>
#include <stdio.h>
#define MOD 1999999973
using namespace std;
int prod;
void rid_put(int x, int put) {
if (put == 0)
return;
if (put % 2 == 1)
prod = (1ll * prod * x) % MOD;
x = (1ll * x * x) % MOD;
rid_put(x, put / 2);
}
int main() {
FILE *fin, *fout;
int n, p;
fin = fopen("lgput.in", "r");
fscanf(fin, "%d%d", &n, &p);
fclose( fin );
prod = 1;
rid_put(n, p);
fout = fopen("lgput.out", "w");
fprintf(fout, "%d", prod);
fclose( fout );
return 0;
}