Consolidating Windows
Time limit1sMemory limit1024 MB
Given two square window side lengths a and b, output the side length of one square whose area equals a squared plus b squared.
- Level
Easy2 of 10
- Topics
- Math
- Solved
- No attempts yet
Problem
In the 19th century, windows were a costly luxury in Delft, because every window in a home was taxed. Only wealthy people could afford more than a few, while many poorer residents bricked up some of their windows to avoid the new costs.
Not wanting to give up any sunlight, Corry came up with a clever idea. The tax depended only on the number of windows, not their size, so she decided to install fewer, larger windows instead of many small ones. In each room, Corry had two square windows. She planned to replace them with one square window to halve the tax. The area of the new window must equal the combined area of the two smaller ones. Given the side lengths of the two smaller windows, what is the side length of the larger window?
Input
One line with two integers and (), the side lengths of the two smaller square windows.
Output
Output the side length of a square window whose area equals the combined area of the two smaller windows.
Your answer should have an absolute or relative error of at most .