Cod sursa(job #2256601)
Utilizator | Data | 8 octombrie 2018 21:06:54 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.25 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream f("lgput.in");
ofstream g("lgput.out");
int main(){
int a,b,p=1;
f>>a>>b;
while(b>=1){
if(b%2==1) p=p*a;
a=a*a;
b=b/2;
}
g<<p;
}