题目

图片.png

题解

图片.png

  1. class Solution {
  2. public:
  3. int mySqrt(int x) {
  4. long b = x;
  5. while (b * b > x) b = (b + x / b) / 2;
  6. return (int)b;
  7. }
  8. };