Solution without log (no loss of precision)


#1

Comment body goes here.int Solution::isPower(int A) {
double l;
if(A==1){
return 1;
}
for(int i=2;i*i<=A;i++){
int b=A;
while(b%i==0){
b /=i;
}
if(b == 1 ) return(1);
}
return 0;

}