UiB Warmup 3 (Fall 2017)


2017-09-13 16:15 CEST

UiB Warmup 3 (Fall 2017)


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

Time elapsed


Time remaining


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!


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.