#include //#define DEBUG using namespace std; int cnt = 0; #ifdef DEBUG int max_num = 20; #else int max_num = 1000000000; #endif int min_num = 10; int que(int num){ cout << "? " << num << endl; int rtn; cin >> rtn; cnt++; max_num--; min_num--; #ifdef DEBUG cout << "cnt:" << cnt << endl; cout << "max_num:" << max_num << endl; cout << "min_num:" << min_num << endl; #endif return rtn; } int main() { int ans; while ((max_num - min_num) > 1) { if ((cnt % 9) == 0) { ans = que(10); if (ans != 1) { if (ans == -1) { while (true) { ans = que(0); if (ans == 0) { min_num = 0; break; } } }else{ min_num = 10; } break; } } else { int num = (max_num + min_num) / 2; ans = que(num); if (ans == 0) { min_num = num; break; } if (ans == 1) { min_num = num; } else { max_num = num - 1; } } } if(ans == 0) { cout << "! " << min_num + cnt - 1 << endl; }else{ cout << "! " << min_num + cnt << endl; } return 0; }