## Uneven Sand

View as PDF

Points: 5
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

Having just landed in the desert Kira remembers that his Strike Gundam is not yet programmed for sand environments. He needs to determine the right amount of pressure that the Strike needs to exert on the sand so that it will neither sink nor float. In other words, he needs the pressure to be an exact number. He knows that the maximum pressure that needs to be exerted is and the minimum pressure is . He wants to find this number in at most guesses.

#### Interaction

This is an interactive problem. Your program will keep outputting numbers between and inclusive and reading a line of input after each output. The line your program reads will be FLOATS if your guess for the pressure is too high, SINKS if your guess for the pressure is too low, and OK if you have the right number. At this point, your program should terminate.

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

#### Sample Interaction

>>> denotes your output; don't actually print this out.

>>> 1
SINKS
>>> 6
SINKS
>>> 10
SINKS
>>> 40
FLOATS
>>> 32
OK

• MioSenpai  commented on Oct. 20, 2018, 11:58 p.m.

Shinn > Kira

• anasschoukri2  commented on Sept. 17, 2017, 3:04 p.m. edited

update : it s ok hehe :p

• Itachi  commented on July 11, 2016, 1:49 p.m.

I resubmitted this and got this. I'm assuming that this is a problem with Turing?

• quantum  commented on July 12, 2016, 1:14 p.m.

You will notice that (most) interactive problems are impossible to solve at this time, since they were not updated after we rewrote a major part of the judge.

• Kirito  commented on March 31, 2017, 12:21 p.m.

Judge is now fixed; all submissions have been rejudged.

• msa789  commented on Dec. 30, 2014, 9:56 p.m.

im getting AC for all of the cases and all the times are all within the limit. How am I still not getting points for 2 of the cases?

• FatalEagle  commented on Dec. 30, 2014, 10:28 p.m.

You are exceeding the 31 guess limit. I fixed the grader to output WA when this happens. All submissions have been rejudged.

• awaykened  commented on Dec. 30, 2014, 10:22 p.m.

((correct me if i'm wrong)) I think something is buggy with the system :x. nonetheless, the score for your program is correct, and your program fails test cases 1 and 5

• Yuting9  commented on Dec. 30, 2014, 8:44 p.m.

Even -snip- on C++ isn't fast enough... Am I doing something wrong?

• BMP  commented on Dec. 30, 2014, 9:25 p.m.

cout.flush();

• FatalEagle  commented on Dec. 30, 2014, 8:52 p.m.

Do not post solutions in the comments.

Your C++ solution is not flushing stdout.

This may be of interest to you.

http://lmgtfy.com/?q=How+to+flush+stdout+C%2B%2B

• Yuting9  commented on Dec. 31, 2014, 4:04 p.m.