java 代码
class Solution {
public double Power(double base, int exponent) {
if(base == 0 && exponent == 0){
return 0;
}
double result = 1;
int temp = exponent;
if(exponent<0){
exponent = -exponent;
}
for(int i=1;i<=exponent;i++){
result = result * base;
}
return temp>=0?result:1/result;
}
}