RT,蒟蒻只会下面这种:
int main(){ int l=0,r=maxn,mid,ans; while(l<=r){mid=(l+r)>>1; if(check(mid)){ans=mid;r=mid-1;} else l=mid+1; }cout<<ans<<endl; }