You friend is thinking of a number between and , and you are trying to guess it in as few guesses as possible. In response to each of your guesses, they will respond "HIGHER", "LOWER", or "CORRECT". You are required to find the number with at most guesses.
Interaction
The first line of input contains integers and , the range of valid numbers. You may now make guesses by printing an integer. In response to each of your guesses, the judge will respond with a line containing HIGHER
, LOWER
or CORRECT
which you can read as a line of input.
Example
The judge first inputs
1 10
Your program prints 5
.
LOWER
Your program prints 4
CORRECT
Constraints
Template
l,r = (int(x) for x in input().split())
while True:
print(guess)
response = input()
# Process response
if response == "CORRECT":
break
Comments