详细
直接快速幂即可
class Solution {
public:
double myPow(double x, int n) {
double res = 1;
if(n < 0){
n = (long long)abs(n);
x = 1.0/x;
}
while(n > 0){
if(n&1)
res *= x;
n>>=1;
x *= x;
}
return res;
}
};