当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

4047:Raining

题目描述
There are N mountains represented by N Isosceles triangles above ground. We can assume that every adjacent mountain can shape a valley. When it rains, the rain will form a plane in the valley. Now let's make things a little easier by drawing the vertical profile of the actual mountains. You can get more details from the below figure.

When it rains, the quantity of water is proportional to the time that is raining and the length of the plane by which some valley can receive the water (in the figure 1, “l1” is the length of the plane). In the figure 1, v means the velocity of the rain (please see the figure for more details for the formula of the rain). If a valley is filled with rain, the water will overflow. According to the shape of the mountain, the water may flow to the left, or to the right. You can assume that the height of the different mountains are different. This outflow of water will fill the valley next to the current valley. You can get the more details from the Figure 2.
  
You will get the information of the mountain. Please output the time during which the mountains can be filled by the rain. After the time, the quantity of the water will not increase even if it still rains.



输入解释
The first line of an input file consists of a single number denoting the number of test cases in the file. The number of cases is not more than 20.
  For each test case, the input format is as follows. The first line gives two integers N and V( 1<=N<=5000, 20<=V<=200). N is the number of the mountains and V is the velocity of the rain. For the next n lines, the ith line gives three integers Li, Ri, Hi( 0<=Li<Ri<=10^9, 1<=Hi<=2500000, i=1, 2, ... , N). li is the coordinate of the left bottom point of the ith mountain. And the ri is the right one. hi is the height of the ith mountain. You can assume that Li<=Ri-1.We guarantee that the valley exists between every two adjacent mountains. You can assume that the left coordinate of the i+1th mountain is strictly larger than the corresponding one of the ith mountain. Please mind that there may be such conditions like the figure 3.
输出解释
For each test case, print the time we need. The number must be printed with 3 decimal digits. (The number must be rounded up or down according to the usual rounding rules.
输入样例
2

2 3
0 2 1
1 5 2

5 3
0 26 37
17 59 35
48 81 79
77 123 77
106 212 33
输出样例
0.042
11.384
来自杭电HDUOJ的附加信息
Recommend lcy

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-4047

最后修改于 2020-10-25T23:09:35+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)