解题思路: 牛顿迭代法, https://en.wikipedia.org/wiki/Integer_square_root#Using_only_integer_division
点击打开链接
class Solution {public: int mySqrt(int x) { long long r = x; while (r*r > x) r = (r + x/r) / 2; return r; }};
新闻热点
疑难解答