## TLE '17 Contest 5 P1 - Guess the Number

View as PDF

Points: 3 (partial)
Time limit: 2.0s
Memory limit: 256M

Author:
Problem type
Fax and Flaco are playing Guess the Number.

Fax McClad, Croneria's luckiest bounty hunter, is playing a guessing game with Flaco.

Flaco chooses an integer between and , inclusive. Then, Fax will repeatedly make guesses until he is certain what is.

Suppose Fax guesses . Then, Flaco will tell him that he is away from the answer.

There are a lot of Moneys on the line, and the fewer the guesses Fax makes, the more Moneys he will win! Please help Fax to determine what Flaco's secret number is!

#### Interaction

This is an interactive problem.

Output guess n to guess a number n. This number should be between and , inclusive. Then your program should read in an integer, which is the value of .

When you are sure about your answer, output answer n, where n is your answer, and terminate.

Each time you output a number, make sure to output a new line \n and flush your output buffers. You can use fflush(stdout) in C++, System.out.flush(); in Java, or import sys; sys.stdout.flush() in Python 2/3. For other languages, search in its documentation.

#### Sample Interaction

>>> denotes your output; don't actually print this out.

>>> guess 5
5
>>> guess 3
7
>>> guess 14
4
>>> guess 10
0
>>> guess 11
1
>>> answer 10

Note that guesses were made. That is, answer does not count as a guess.