#include using namespace std; int ask(int Y){ cout << "? " << Y << endl; int res; cin >> res; return res; } int solve(){ int askCount = 0; for(int i=2;i<=50;i++,askCount++){ int res = ask(i); if(res < 0){ return i - 1 + askCount; } if(res == 0){ return i + askCount; } } // [lo, hi] int lo = 50, hi = 1e9 - askCount; for(;;++askCount){ int mid = (lo + hi) / 2; int res = ask(mid); if(res == 0){ return mid + askCount; } if(res < 0){ hi = mid - 1; } else { lo = mid + 1; } if(lo == hi){ return lo + askCount; } --lo; --hi; } return -1; } int main(){ int Y = solve(); cout << "! " << Y << endl; return 0; }