class Solution {
public:
double quick(double base, int exponent){
double res = 1;
while(exponent){
if(exponent & 1) res *= base;
base *= base;
exponent >>= 1;
}
return res;
}
double Power(double base, int exponent) {
bool flag = false;
if(exponent < 0) flag = true, exponent = -exponent;
double res = quick(base, exponent);
if(flag) res = 1 / res;
return res;
}
};