|
|||||||||||||||||||
|
SPOJ time: 2012-05-26 14:03:13 |
Pythagorean tentProblem code: HS09PYTH
The PythTent Corporation assembles tents of an unusual Pythagorean shape. Each tent is a right prism, where the front and the rear wall of the tent is a Pythagorean triangle, i.e. a right triangle with sides of integer length (measured in centimeters). The right angle is the one on the roof. Unfortunately, their database crashed lately and there are many gaps in the data. For many tent projects all that remains known is the area of the fabric needed to make the floor and roof (together), and the area of the front and rear wall (together). Also the length of the tent (i.e. the distance from the front to the rear wall) is known. However, the Head of Department responsible for tent frame production needs to know the height of each tent! Write a program to help him.
InputThere are K (1≤K≤30 000) lines of input. Each line contains three integers F, S, h (1≤F, S≤2 000 000 000; 10≤h≤500), where F – the area of the front (or rear) triangle in square centimeters, S – the area of the floor and roof in square centimeters, h – length of the tent. Line K+1 contains three zeros, which shouldn't be processed.
OutputWrite a number for each line of input, which is the height of the tent for the given testcase, accurate to 0.01. ExampleInput: ScoringFor solving this problem you will score 10 points.
|
||||||||||||||||||
| |||||||||||||||||||