class Solution {
public:
int mySqrt(int x) {
long a = x;
while (a * a > x){
a = (a + x / a) / 2;
}
return a;
}
};
Leet Code 69. x 的平方根
发布时间 2023-04-05 11:49:07作者: 破忒头头
class Solution {
public:
int mySqrt(int x) {
long a = x;
while (a * a > x){
a = (a + x / a) / 2;
}
return a;
}
};