// yukicoder: No.253 ロウソクの長さ // 2019.5.10 bal4u #include #include #define gc() getchar() #define pc(c) putchar(c) int in() { int n = 0, c = gc(); if (c == '-') { c = gc(); do n = 10*n + (c & 0xf), c = gc(); while (c >= '0'); return -n; } do n = 10*n + (c & 0xf), c = gc(); while (c >= '0'); return n; } void out(int n) { int i; char ob[20]; if (!n) pc('0'); else { i = 0; while (n) ob[i++] = n%10 + '0', n/=10; while (i--) pc(ob[i]); } pc('\n'); } int x = 1000000000; int answer(int y) { int r; if (x < y) r = -1; else if (x > y) r = 1; else if (y == x) r = 0; x--; return r; } int ask(int y, int k) { int a; #if 0 a = answer(y); #else pc('?'), out(y), fflush(stdout); a = in(); #endif if (a == 0) { pc('!'), out(y+k); exit(0); } return a; } int main() { int a, k, l, r, m; m = 100, k = 0; a = ask(m, k++); if (a > 0) l = m, r = 1000000001; else l = 9, r = m-1; while (l < r) { m = (l + r) >> 1; a = ask(m, k++); if (a > 0) l = m, r--; else l--, r = m-1; } pc('!'), out(l+k), fflush(stdout); return 0; }