标签:public bsp for div nbsp logs col pow style
Implement pow(x, n).
class Solution { public: double myPow(double x, int n) { double res=1; long long int p=n; if(n<0){ p=-p; x=1/x; } for(;p;p>>=1){ if(p&1)res*=x; x*=x; } return res; } };
标签:public bsp for div nbsp logs col pow style
原文地址:http://www.cnblogs.com/tsunami-lj/p/7620285.html