Cod sursa(job #981166)
Utilizator | Data | 6 august 2013 15:21:02 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 10 |
Compilator | c | Status | done |
Runda | Arhiva educationala | Marime | 0.3 kb |
#include <stdio.h>
#define DIVIDER 1999999973
long pow1(int a, int b)
{
long exp = a;
while (--b)
exp *= a;
return exp;
}
int main()
{
int N, P;
freopen("lgput.in", "r", stdin);
freopen("lgput.out", "w", stdout);
scanf("%d %d", &N, &P);
printf("%ld", pow1(N, P) % DIVIDER);
return 0;
}