#include using namespace std; int main() { int L = 1, R = 1000000; long long prev = 1; cout << "? " << prev << endl; cout.flush(); while (L < R) { int mid = (L + R) / 2; long long x = 2LL * mid + 1 - prev; cout << "? " << x << endl; cout.flush(); int res; cin >> res; if (res == -1) return 0; if (x > prev) { // res = 1 <=> |a-prev| >= |a-x| // <=> a >= mid + 1 if (res == 1) { L = mid + 1; } else { R = mid; } } else { // x < prev のときは向きが逆 // res = 1 <=> a <= mid if (res == 1) { R = mid; } else { L = mid + 1; } } prev = x; } cout << "! " << L << endl; cout.flush(); return 0; }