题目链接

两个乘积的均值比这两个数值的本身更加趋近于根号x本身。
class Solution {// 4.牛顿迭代,1ms,94.76%public int mySqrt(int x) {if(x == 0) return 0;return (int)newDun(1, x);}public double newDun(double n, int x) {double res = (n + x/n)/2;if(res == n) {return n;} else {return newDun(res, x);}}}
