Cod sursa(job #1939894)
Utilizator | Data | 26 martie 2017 09:30:56 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.31 kb |
#include <fstream>
using namespace std;
ifstream f("lgput.in");
ofstream g("lgput.out");
int n, p;
unsigned long long xlaputere;
int main()
{
f>>n>>p;
xlaputere = n;
while(p>1) {
xlaputere = xlaputere * xlaputere;
p/=2;
}
g<<xlaputere;
return 0;
}