This is an interactive problem.
Like everyone, Nubu the random coder girl, has a secret password. One day some of her friends wanted to guess her password. They call it a guessing game! To make the guessing game more interesting, she reveals them that the password is an integer number between and . Let’s say, her secret password is . Her friends can tell her a positive integer number, . In return, she will tell them the value of . But the friends can not ask more than times. The friends can not figure out how they can do it. So they have come to you!
The first line will contain the number of test cases ().
For each test case, to ask a question, print "? m" (without quotes) in a line, where . Then, you should read a single integer. The integer will denote the .
If you think you have found the password then, print "! n" (without quotes) in a line. After that, continue to the next test case (do not need to take any input). If you pass every test case correctly, then you will get "Accepted", otherwise "Wrong Answer" verdict.
You can ask at most questions (excluding printing answer). If you exceed the number of questions or ask any invalid question, you will receive as the answer of your question.
At any point, terminate your program immediately after receiving and you will see Wrong answer verdict. Otherwise, you can get an arbitrary verdict because your solution will continue to read from a closed stream.
If we assume the secret number is 15 then interaction may look like:
> 1 < ? 5 > 5 < ? 3 > 3 < ? 15 > 15 < ? 30 > 15 < ! 15
> indicates what your program reads and
< indicates what your program writes. These symbols are here to make it easy to understand. You do not have to print such symbols from your program.
To learn more about Interactive Problems: https://help.toph.co/toph/interactive-problems
Login to submit