题目描述
blablabla
样例
class Solution {
public:
double Power(double base, int exponent) {
bool mines = false;
if(exponent<0){
exponent = exponent*-1;
mines = true;
}else if(exponent==0){
return 1;
}
double res = 1;
int t = base;
while(exponent){
if(exponent&1){
res *=t;
}
exponent >>= 1;
t = t*t;
}
if(mines) return 1/res;
return res;
}
};