Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

An Obvious Interactive Problem

Limits: 1s, 512 MB · Interactive

I pick a number. You guess it.

You can guess at most 25 times. For every guess you make, I will tell you if the number I picked is “Bigger” or “Smaller”. And, if you get it right, I will say “Bingo!”.

The number I will pick will be between 0 and 1000000.

Input

In this problem, for every time you print an integer, you will receive one of the following as input (w/o quotes):

  • “Bigger”
  • “Smaller”
  • “Bingo!”

There will be at most 25 inputs for each of the 25 attempts you can make in this problem to guess the number.

Output

Print at most 25 integers, one per line. Do not print anything after you have guessed the correct number (i.e. after you receive “Bingo!” as input).

Let’s imagine the number is 16. Here is what a possible interaction would look like.

< 5
> Bigger
< 10
> Bigger
< 20
> Smaller
< 16
> Bingo!

> indicates what your program reads and < indicates what your program writes. These symbols are here to make it easy to understand. You do not have to print such symbols from your program.

Your program prints 5. As a result, your program will receive “Bigger” as input. Your program then prints 10. As a result, your program will receive “Bigger” as input.

Your program then prints 20. As a result, your program will receive “Smaller” as input. Your program then prints 16. As a result, your program will receive “Bingo!”.

Discussion