ENG  RUSTimus Online Judge
Online Judge
Online contests
About Online Judge
Frequently asked questions
Site news
Problem set
Submit solution
Judge status
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests

USU Open Personal Contest 2010

About     Problems     Submit solution     Judge status     Standings
Contest is over

A. Bookshelf

Time limit: 0.5 second
Memory limit: 64 MB
A bookshelf has length L and borders of height h. A book of height H is standing vertically at its left side. Bibliophile gnomes want to drop the book onto the shelf. For that, they pull the lower edge of the book to the right along the surface of the shelf. The left side of the book remains leaning on the left border of the shelf. The gnomes pull the book until it lies horizontally on the shelf. However, the gravity may get in their way: if the center of the book gets too far beyond the left edge of the shelf, the book may overturn and fall to the floor.
Problem illustration
Let us assume that the book, shelf, and borders of the shelf have zero width. It is required to find how far to the left the center of the book can get in the process of the motion.


The only input line contains the integers h, H, and L (1 ≤ h < H < L ≤ 1000).


Output the value of the maximal displacement to the left of the center of the book with respect to the left side of the shelf accurate up to at least 10−5.


7 120 200
Problem Author: Dmitry Ivankov
Problem Source: XI USU Open Personal Contest (March 13, 2010)
To submit the solution for this problem go to the Problem set: 1753. Bookshelf