#include #include #include using namespace std; int main(){ int l,r; l = 1; r = pow(10,9); char c; while(1){ int mid = ceil((double)(l+r)/2); cout << '?' << ' ' << mid << endl; fflush(stdout); cin >> c; if(c == '1') l = mid; else r = mid-1; if(r - l == 1){ cout << '?' << ' ' << r << endl; fflush(stdout); cin >> c; if(c == 1) cout << '!' << ' ' << r << endl; else cout << '!' << ' ' << l << endl; return 0; } if(r == l){ cout << '!' << ' ' << r << endl; return 0; } } }