UiB Warmup 3 (Fall 2017)

Start

2017-09-13 16:15 CEST

UiB Warmup 3 (Fall 2017)

End

2017-09-13 19:00 CEST
The end is near!
Contest is over.
Not yet started.
Contest is starting in -9 days 13:46:47

Time elapsed

2:45:00

Time remaining

0:00:00

Problem G
Guess the Number

I am thinking of a number between $1$ and $1000$, can you guess what number it is? Given a guess, I will tell you whether the guess is too low, too high, or correct. But I will only give you $10$ guesses, so use them wisely!

Interaction

Your program should output guesses for the correct number, in the form of an integer between $1$ and $1000$ on a line on its own. After making each guess, you need to make sure to flush standard out.

After each guess, there will be a response to be read from standard in. This response is a line with one of the following three words:

  • lower” if the number I am thinking of is lower than your guess

  • higher” if the number I am thinking of is higher than your guess

  • correct” if your guess is correct

After having guessed the right answer your program should exit. If you guess incorrectly $10$ times, you won’t get any more chances and your program will be terminated.