#include #include #include #include #define REP(i,a,b) for(i=a;i 0) { if(n&1) res = res * x; x = x * x; n >>= 1; } return res; } int main(void) { int i,j,k; int left = 0, right = (int)ll_pow(10,9)+1,mid; while(left < right) { mid = (left+right)/2; int rep; cout << "? " << mid << endl; cout << "left = " << left << endl; cout << "right = " << right << endl; cout << "mid = " << mid << endl; cin >> rep; if(rep) left = mid; else right = mid-1; if(left + 1 == right) { cout << "? " << mid << endl; cin >> rep; if(rep) left = right; } if(mid == (left+right)/2) break; } cout << "! " << left << endl; return 0; }