Mars mission
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 and .
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 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()
.
留言