#include #include using namespace std; int main(){ int left = 0, right = 1e9; random_device rnd; while(left < right){ int middle = rnd() % (right - left + 1) + left; cout << "? " << middle << endl; bool response; cin >> response; if(response){ left = middle; }else{ right = middle - 1; } } cout << "! " << left << endl; }