Mars mission


提交答案

分數: 100
時間限制: 1.0s
記憶體限制: 128M

作者:
題目類型
允許的語言
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().


留言

目前沒有評論。