Submit | All submissions | Best solutions | Back to list |
HS09PYTH - Pythagorean tent |
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.
Input
There 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.
Output
Write a number for each line of input, which is the height of the tent for the given testcase, accurate to 0.01.
Example
Input:6 120 10
24 2400 100
0 0 0
Output:
2.40
4.80
Scoring
For solving this problem you will score 10 points.
Added by: | Adam Dzedzej |
Date: | 2010-03-02 |
Time limit: | 0.200s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | ADA95 ASM32 BASH BF C CSHARP CPP C99 CLPS LISP sbcl LISP clisp D FORTRAN HASK ICON ICK JAVA LUA NEM NICE OCAML PAS-GPC PAS-FPC PERL PHP PIKE PRLG-swi PYTHON RUBY SCM guile SCM qobi ST TCL TEXT WHITESPACE |
Resource: | High School Programming League (thanks to Talent Association) |