You're driving your car in the local hills and returning to your home town. You'd like to get back as quickly as possible; however, you notice that you don't have much fuel left. You know the most efficient route to take. Some parts of this route go downhill, and some go uphill. The different parts have different lengths and slopes. How quickly can you reach home with the little fuel you have left?
We will assume a very simple model for the fuel consumption of your car. Fuel consumption (per unit distance travelled) will increase linearly with your driving speed v. However, there is an offset which depends on the slope s of the hill. For example, when going downhill along a particular road, you might be able to go at 10 km/h without expending any fuel; on the other hand, if you were travelling that same road uphill, you would expend fuel at the same rate as if you were driving 10 km/h faster along a flat road. More specifically, the car's fuel consumption c in liters per kilometer is given by
where α is the standard fuel consumption rate on a flat road, v is your speed in km/h, s is the slope of the road, and β is a positive constant. Acceleration and deceleration do not cost fuel and can be done instantaneously.
Note that your car has a maximum (safe) speed which cannot be exceeded.
c = max(0,α v + β s)
Α是在平路上的油耗,V是速度,s是坡度,β是个常数。
加速减速不耗能量。你的车是有极速的。不可超越
样例
第一行给出α,β,Vmax,和F。
表示的是上式的α,β,极速和油量。
然后是R,表示R段路程。
然后给出R个点,表示水平距离和垂直高度。每个坡斜率相同。
输出
最快到达终点的时间。达不到就写不可能。