What is Jeffrey's favorite integer?
Constraints
Jeffrey's favorite integer is between and
.
Subtask 1 [1 point]
You have 100 guesses to figure it out.
Subtask 2 [1 point]
You have 7 guesses to figure it out.
Interaction Protocol
The interaction will take place over multiple rounds. In one round, you must output a line containing a guess of Jeffrey's favorite integer. Then, you must read in a single integer. Remember to flush your output to standard out before trying to read an integer!
If the guess is exactly equal to Jeffrey's favorite integer, then you will read in a value of CORRECT
. Your program has correctly guessed the password, and you are considered to have solved this test case. Your program should terminate immediately.
Otherwise, you will read in either LESS
or GREATER
. If you read in LESS
, then Jeffrey's integer is less than your guess. If you read in GREATER
, then Jeffrey's integer is greater than your guess.
Sample Interaction
Note that <<<
represents values that you should read from stdin
, and >>>
represents a string that you print to stdout
.
>>> 1
GREATER <<<
>>> 100
LESS <<<
>>> 39
CORRECT <<<
Note that in this sample interaction, Jeffrey's favorite integer is .
Comments