Cod sursa(job #1259162)
Utilizator | Data | 9 noiembrie 2014 19:25:30 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.25 kb |
#include<iostream>
#include<fstream>
using namespace std;
ifstream g("lgput.in");
ofstream f("lgput.out");
int power(int b, int e)
{
if(e == 0)
return 1;
return b * power(b, e-1);
}
int main()
{
int b, e;
g >> b >> e;
f << power(b, e);
}