标签:explain sub double nbsp item 思路 plain 次方 return
1 public class Solution { 2 public double Power(double base, int exponent) { 3 if(exponent==1) return base; 4 if(exponent==-1) return 1/base; 5 if(exponent==0) return 1; 6 double res = Power(base, exponent>>1); 7 res = (exponent & 0x1)==1? base *res*res:res*res; 8 return res; 9 } 10 }
标签:explain sub double nbsp item 思路 plain 次方 return
原文地址:http://www.cnblogs.com/zle1992/p/7791678.html