#BS0000378. Hai thang bắt chéo (Crossed Ladders)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Hai thang bắt chéo (Crossed Ladders)
Crossed Ladders
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
Tall buildings stand along opposite sides of a street. A ladder of length feet rests at the foot of the right wall and leans against the left wall. A ladder of length feet is placed in the opposite direction. Their crossing point is feet above the ground. Find the horizontal distance between the walls.

Input
One line contains three positive real numbers , measured in feet.
Output
Print the width of the street in feet rounded to exactly three decimal places.
Subtasks
- Subtask 1 (20 points): ; . All three numbers are integers and .
- Subtask 2 (30 points): ; . All three numbers are integers.
- Subtask 3 (50 points): ; . Each number has at most 6 digits after the decimal point.
Examples
Input
10 10 3
Output
8.000
Explanation
The equal ladders meet above the midpoint, and each upper endpoint has height . By the Pythagorean theorem the width is .
Input
10 10 1
Output
9.798
Explanation
Both upper endpoints have height 2 feet. The width is , rounded to .
Input
30 40 10
Output
26.033
Explanation
At width , the endpoint heights are about and feet. Their product divided by their sum gives a crossing height of about 10 feet. The unique matching width rounds to 26.033.
Input
12.619429 8.163332 3
Output
7.000
Explanation
For width 7 feet the endpoint heights are approximately 10.5 and 4.2 feet. The crossing height is feet. With the given input precision, the width rounds to 7.000.