赞
踩
- public int mySqrt(int x){
- if (x==1){return 1;}
- if (x==0){return 0;}
- int left = 1, right = x/2;
- while (left < right){
- int mid = left + ((right - left) >> 1);
- if (mid > x/mid){
- right = mid - 1;
- }else {
- left = mid;
- }
- }
- return left;
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。