Bridge |
Time Limit: 1000ms, Special Time Limit:2500ms,Memory Limit:32768KB |
Total submit users: 153, Accepted users:110 |
Problem 10046 : No special judgement |
Problem description |
A suspension bridge suspends the roadway from huge main cables, which extend from one end of the bridge to the other. These cables rest on top of high towers and are secured at each end by anchorages. The towers enable the main cables to be draped over long distances. Suppose that the maximum distance between two neighboring towers is D, and that the distance from the top of a tower to the roadway is H. Also suppose that the shape of a cable between any two neighboring towers is the same symmetric parabola (as shown in the figure). Now given B, the length of the bridge and L, the total length of the cables, you are asked to calculate the distance between the roadway and the lowest point of the cable, with minimum number of towers built (Assume that there are always two towers built at the two ends of a bridge). |
Input |
Standard input will contain multiple test cases. The first line of the input is a single integer T (1 <= T <= 10) which is the number of test cases. T test cases follow, each preceded by a single blank line. For each test case, 4 positive integers are given on a single line. It is guaranteed that B <= L. The cable will always be above the roadway. |
Output |
Results should be directed to standard output. Start each case with "Case #:" on a single line, where # is the case number starting from 1. Two consecutive cases should be separated by a single blank line. For each test case, print the distance between the roadway and the lowest point of the cable, as is described in the problem. The value must be accurate up to two decimal places. |
Sample Input |
2 20 101 400 4042 1 2 3 4 |
Sample Output |
Case 1: 1.00 Case 2: 1.60 |
Judge Tips |
方法一:
桥的间隔数为n = ceil(B/D),每段绳子的长度为L / n,相邻两塔之间的距离为 B / n
主要问题还是在于已知抛物线的开口宽度w 和 抛物线的高度h 求抛物线的长度
设抛物线方程为f(x) = ax2,则这段抛物线弧长为