Cod sursa(job #1268324)
Utilizator | Gafton Mihnea Alexandru fluture.godlike | Data | 20 noiembrie 2014 20:36:32 |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.5 kb |
#include <stdio.h>
#include <math.h>
FILE *fin, *fout;
int a, b;
/*unsigned long long power(unsigned long x, unsigned long y)
{
if(y == 0) return 1;
if(y == 1) return x;
unsigned long long temp = power(x, y/2);
return temp*temp*power(x, y%2);
}*/
int main()
{
fin = fopen("lgput.in", "r");
fout = fopen("lgput.out", "w");
fscanf(fin, "%d%d", &a, &b);
fprintf(fout, "%f", pow(a, b));
fclose(fin);
fclose(fout);
return 0;
}