Mars mission


Submit solution

Points: 100
Time limit: 1.0s
Memory limit: 128M

Author:
Problem type
Allowed languages
C, C++, Java 11, Python, ZIG

Suppose an alien decided to land on Earth, howver, since it is the first time being on Earth, "it" does not know how much force to exert on his spacecraft's engine. Thus, he must do it by trial and error observation.

You will write a program to adjust your system to compensate the exhaust force of your engine according to the output. The force will be between 1 and 2 \times 10^9. The line your program reads (observed) will be UP if your guess for the engine exhaust is too high, DOWN if your guess for the engine exhaust is too low, and OK if you have the right number. At this point, your program should terminate. You have at most 31 guesses to complete this task.

Each time you output a number, you need to output a new line and flush your output buffers. For example, in Python 2 you can do this with import sys; sys.stdout.flush(), and in Java with System.out.flush().


Comments

There are no comments at the moment.