首页 > 其他分享 >images

images

时间:2022-10-01 20:22:54浏览次数:47  
标签:guess rightP int mid return images leftP

二分法溢出的情况:
image


public int guessNumber(int n) {
        int leftP = 1;
        int rightP = n;
        int mid = 0;
        while(leftP < rightP){
		//皆是因为mid = (rightP + leftP) /2;
            mid = leftP + (rightP - leftP) / 2;
            if(guess(mid) == 0){
                return mid;
            }else if(guess(mid) == -1){
                rightP = mid;
            }else if(guess(mid) == 1){
                leftP = mid + 1;
            }
        }
        return rightP;
    }

标签:guess,rightP,int,mid,return,images,leftP
From: https://www.cnblogs.com/MR---Zhao/p/16747698.html

相关文章

  • docker 创建镜像images
    1.先下载基础镜像,并准备好你要部署的jar包 2.编写dockerfile 文件FROMascdc/jdk8:latestRUNmkdir-p/home/app/demo&&chmod777/home/app/demo&&cd/home......