Cod sursa(job #613886)
Utilizator | Data | 4 octombrie 2011 23:29:21 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.34 kb |
#include <cstdio>
long pow(int a, int b)
{
if ( b == 0 ) return 1;
if ( b%2 == 0 )
return pow(a*a, b/2);
else
return a*pow(a*a, b/2);
}
int main()
{
int x, y;
long r;
freopen("lgput.in", "r", stdin);
freopen("lgput.out", "w", stdout);
scanf("%d%d", &x, &y);
r = pow(x, y);
printf("%l", r%1999999973);
}