In my opinion the problem statement is quite unclear. Although it is said in it that the book might fall at some point it never does (even if it goes beyond the line where physic laws say it falls). The problem my team was solving during the contest was to determine when the book will fall if it falls (and at what X this would happen), and if it doesn't - what is the furthest point to the left the middle of it can go while sliding over the shelf (the original problem). Please change the statement so other people are not confused by this ambiguity.
The value of L is non-information. The text suggests the book may fall, but to solve the problem you have to pretend it doesn't (zero gravity, weightless book, magical forces). I propose that the problem setter should shelve books for the rest of his life and stay away from programming.
Does it mean that we need to calculate the maximal displacement where the center goes even when it falls? And after the book starts falling must we consider that the book just rotates around the edge of the bookshelf? or it slides a little backwards. Some more explanation of the problem text and maybe some hints would be welcomed. Thank you.
L.E. Now I get WA 8. I don't think there is a problem with precision, or something like that. Some more samples to pass this test? Does L have to be used at anything? I believe not since L>H.
L.L.E. My WA 8 was from a division by 2 of an integer variable, which I assigned to a double variable. The problem was solved when I divided by 2.0