#BS0000386. Cầu treo (Suspension Bridges)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Cầu treo (Suspension Bridges)
Suspension Bridges
Source: Kattis
Version: Phuoc Hung OJ Extended
Problem Statement
A mountain village plans a suspension bridge over a gorge. The two cable anchors are at equal elevation and horizontal distance apart. The cable’s lowest point is midway between the anchors and below them. A freely hanging cable forms a catenary, with a positive parameter satisfying
The cable length is , where and . Compute the required cable length.
Input
One line contains integers , the horizontal anchor separation and the central sag.
Output
Print the cable length. The absolute error must not exceed .
Subtasks
- Subtask 1 (20 points): ; .
- Subtask 2 (30 points): ; .
- Subtask 3 (50 points): .
Examples
Input
400 40
Output
410.474747252
Explanation
The anchors are 400 apart and the sag is 40. The parameter satisfies . Its approximate value is . Substitution into gives approximately 410.474747252.