标签:int else amp bsp while etc double lse leetcode
50. Pow(x, n) (中等)
double myPow(double x, int n) { double ans = 1; unsigned long long p; if (n < 0) { p = -n; x = 1 / x; } else { p = n; } while (p) { if (p & 1) ans *= x; x *= x; p >>= 1; } return ans; }
标签:int else amp bsp while etc double lse leetcode
原文地址:https://www.cnblogs.com/zpcoding/p/10205578.html