|
|||||||||||||||||||
|
SPOJ time: 2012-05-26 14:01:11 |
Bridge BuildingProblem code: HS09BRI
Find a place to build a bridge over the river, so as to minimize the length of the shortest route between two cities A and B, located on opposite sides of the river.
InputThere is exactly one line of input, containing four integers a, b, c, and h (10 ≤ a, b, c, h < 1000000), separated by spaces. a - the distance from city A to the river (the length of segment AE in the figure), b - the distance from city B to the river (the length of segment BG in the figure), c - the distance between A and B along the axis parallel to the river (the length of segment BF in the figure) and h - the width of the river (CD in the figure). OutputYour program should write a single number to the standard output, equal to the length of the shortest path between A and B using the bridge, accurate up to two digits after the decimal dot. ExampleInput: 10 12 90 10 Output: 102.65 ScoringFor solving this problem you will score 10 points.
|
||||||||||||||||||
| |||||||||||||||||||