#include #include #include int main() { int n,k,x,xmin,xmax; char s[100]={'0'}; scanf("%d%d",&n,&k); xmin=1; xmax=n; x=(xmin+xmax)/2; if(k==1)x=1; while(strcmp(s,"exit")!=0) { printf("query %d\n",x); fflush(stdout); scanf("%s",s); if(k>1){ if(strcmp(s,"broke")==0) { k--; if(k==1) { x=xmin; continue; } else xmax=x; } else if(strcmp(s,"survived")==0) { xmin=x+1; } else if(strcmp(s,"error")==0) strcpy(s,"exit"); if(xmin==xmax) { printf("answer %d\n",xmax); fflush(stdout); scanf("%s",s); } else { if(k!=1) x=(xmin+xmax)/2; } } else { if(strcmp(s,"broke")==0) { printf("answer %d\n",x); fflush(stdout); scanf("%s",s); } else x++; } } return(0); }