int l=0,r=100,ans=0; while(l<=r){ mid=(l+r)/2; if (check(mid)) { l=mid+1;ans = mid; } else r=mid-1; //注意+1,-1否则死循环 }