#include<bits/stdc++.h> using namespace std; int main(){ long n,m; n=1;m=1000000000; int ans; int pd; do{ ans=rand()%(m-n+1)+n; cout<<ans<<endl; cin>>pd; if(pd==1) m=ans; else if(pd==-1) n=ans; }while(pd!=0); return 0; }
有解决方案吗