B:暗水位
补题链接🔗:https://cpc.csgrandeur.cn/csgoj/problemset/problem?pid=1584
二分
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
#define fi first
#define se second
const ll N=5005,mod=92084931,INF=1e18;
void solve(){
ll l=0,r=1e9;
while(l<r){
ll mid=(l+r)/2;
cout<<"?"<<" "<<mid<<endl;
cout.flush();
ll res;
cin>>res;
if(res==1){
r=mid;
}else{
l=mid+1;
}
}
cout<<"!"<<" "<<l<<endl;
cout.flush();
}
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll T = 1;
//cin >> T;
while (T--)
solve();
return 0;
}

浙公网安备 33010602011771号