347 人解决,389 人已尝试。
363 份提交通过,共有 1080 份提交。
1.9 EMB 奖励。
单点时限: 2.0 sec
内存限制: 512 MB
Renatus has a large cylindrical water storage tank.
The bottom area of the tank is $S$ square meters and the height is $H$ meters.
Now, there are $n$ taps on the side of the tank. The height of the $i$-th tap is $h_i$ and its water rate is $v_i$ cubic meters per second. This means that for the $i$-th tap, when the current water level of the tank is above $h_i$, the water in the tank will flow out of this tap at a rate of $v_i$ cubic meters per second, and when the current level of the tank is below $h_i$, no water will flow out of it.
Now you know the information of all the taps. The water level is $H$ at the beginning. How long does it take before the water level does not change anymore?
In the first row, two positive integers $S,H$, the bottom area and height of the tank.
In the second row, an integer $n$ indicates the number of taps.
The next $n$ rows, each with two integers $h_i,v_i$, indicate the height of the $i$-th tap and its water rate, respectively.
It is guaranteed that $\forall 1<i\le n$, $h_{i-1} \ge h_i$.
Please pay attention to the data constraints.
Output one line, a real number, indicating the answer.
Your answer will be considered correct if it is within $10^{-6}$ of the standard answer in absolute or relative terms.
5 10 3 6 2 4 1 0 1
30.0000000000
5 6 1 0 7
4.2857142857
$1\le S,H \le 10^4$
$0\le n \le 10^5$
$0\le h_i \le H$
$1\le v_i \le 10^4$
347 人解决,389 人已尝试。
363 份提交通过,共有 1080 份提交。
1.9 EMB 奖励。
创建: 2 年,11 月前.
修改: 2 年,11 月前.
最后提交: 8 月前.
来源: N/A