#include using namespace std; const int top = 1e9 + 1; const int bottom = 1; int main() { int left = bottom; int right = top; int mid; int result; while( abs(right - left) <= 1 ) { mid = (left + right) / 2; cout << "? " << mid << endl; cin >> result; if(result) left = mid; else right = mid; } cout << "! " << left << endl; return 0; }