题目:
题解:
使用最经典普通二分即可
int guessNumber(int n) {
long l=0,r=n,mid;
while(l<=r){
mid=(r+l)>>1;
if(guess(mid)==0)return mid;
else if(guess(mid)==-1)r=mid-1;
else l=mid+1;
}
return 0;
}