//https://ncode.syosetu.com/n4830bu/246/ #include using namespace std; int main() { int ok = 0; int ng = 1e9 + 10; auto check = [](int x) { cout << "? " << x << endl; int res; cin >> res; return res; }; while (abs(ok - ng) > 1) { int mid = (ok + ng) / 2; if (check(mid)) { ok = mid; } else { ng = mid; } } cout << "! " << ok << endl; }