/* -*- coding: utf-8 -*- * * 1187.cc: No.1187 皇帝ペンギン - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ const int MAX_N = 1000; /* typedef */ /* global variables */ /* subroutines */ bool check(int x) { printf("? %d\n", x); fflush(stdout); char s[8]; scanf("%s", s); return (s[0] == 's'); } /* main */ int main() { int x0 = 0, x1 = MAX_N; while (x0 + 1 < x1) { int x = (x0 + x1) / 2; if (check(x)) x0 = x; else if (check(x + 1)) x0 = x + 1; else x1 = x; } printf("! %d\n", x1 - 1); fflush(stdout); return 0; }