#include #include using namespace std; int n_ask = 0; int ask(int Y){ cout << "? " << Y << endl; int res; cin >> res; n_ask++; return res; } int main() { int ret = ask(64); if (ret == 0) { cout << "? 64" << endl; return 0; } int n_bit = ret == 1 ? 31 : 6; int ans = 1 << n_bit; ans--; for (int i = n_bit - 1; i >= 0; i--) { int tmp = ans - (1 << i); ret = ask(tmp - n_ask); if (ret == 0) { ans = tmp; break; } else if (ret < 0) { ans = tmp; } } cout << "! " << ans << endl; }