Cod sursa(job #937491)
Utilizator | Data | 10 aprilie 2013 14:25:45 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.22 kb |
#include <fstream>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
int main ()
{
int x,n;
fin>>n>>x;
if(n%2==0)
x=(x*x)*n/2;
else
x=x*(x*x)*((n-1)/2);
fout<<x;
return 0;
}