r*y
2 楼
看青年医生有感,姚笛非得找文章干吗,还是已婚的,任重看着挺靠谱儿的,一看就是
实诚人哪。不过我觉得任重有点儿gay气质。。。
实诚人哪。不过我觉得任重有点儿gay气质。。。
p*s
3 楼
double mySqrt(int num) {
if(num < 0) {
return -1;
}
double precise = 0.0001;
double low = 0;
double high = num;
double mid = (low+high)/2;
while(abs(mid*mid - num) > precise) {
if(mid*mid > num) {
high = mid;
} else {
low = mid;
}
mid = (low+high)/2;
}
return mid;
}
if(num < 0) {
return -1;
}
double precise = 0.0001;
double low = 0;
double high = num;
double mid = (low+high)/2;
while(abs(mid*mid - num) > precise) {
if(mid*mid > num) {
high = mid;
} else {
low = mid;
}
mid = (low+high)/2;
}
return mid;
}
n*2
4 楼
非常gay
p*s
7 楼
这个思路和binary search一样, 只不过判断条件不一样~
http://codinggeeks.blogspot.com/2010/04/computing-square-cube-roots.html
http://codinggeeks.blogspot.com/2010/04/computing-square-cube-roots.html
r*g
11 楼
I thought that this method is called the bisection method.
http://en.wikipedia.org/wiki/Bisection_method
http://en.wikipedia.org/wiki/Bisection_method
z*e
13 楼
exactly.
【在 r********g 的大作中提到】
: I thought that this method is called the bisection method.
: http://en.wikipedia.org/wiki/Bisection_method
【在 r********g 的大作中提到】
: I thought that this method is called the bisection method.
: http://en.wikipedia.org/wiki/Bisection_method
相关阅读