//https://ncode.syosetu.com/n4830bu/253/ #include using namespace std; int Time = -1; int ask(int Y) { Time++; cout << "? " << Y << endl; int res; cin >> res; return res; } int main() { int res = ask(100); if (res == 0) cout << "! 100" << endl; else if (res < 0) { while (res != 0) res = ask(1); cout << "! " << Time + 1 << endl; } else { int ok = 1e9 + 10; int ng = 0; while (abs(ok - ng) > 1) { int mid = (ok + ng) / 2; res = ask(mid - Time); if (res == 0) { ok = mid; break; } if (res == -1) { ok = mid; } else { ng = mid; } } cout << "! " << ok + 1 << endl; } }