1626: [NOIP1999 提高组] 旅行家的预算

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:7 Solved:5

Description

一个旅行家想驾驶汽车以最少的费用从一个城市到另一个城市(假设出发时油箱是空的)。给定两个城市之间的距离 lns="http://www.w3.org/1998/Math/MathML">D_1、汽车油箱的容量 lns="http://www.w3.org/1998/Math/MathML">C(以升为单位)、每升汽油能行驶的距离 lns="http://www.w3.org/1998/Math/MathML">D_2、出发点每升汽油价格lns="http://www.w3.org/1998/Math/MathML">P和沿途油站数 lns="http://www.w3.org/1998/Math/MathML">Nlns="http://www.w3.org/1998/Math/MathML">N 可以为零),油站 lns="http://www.w3.org/1998/Math/MathML">i 离出发点的距离 lns="http://www.w3.org/1998/Math/MathML">D_i、每升汽油价格 lns="http://www.w3.org/1998/Math/MathML">P_ilns="http://www.w3.org/1998/Math/MathML">i=1,2,…,N)。计算结果四舍五入至小数点后两位。如果无法到达目的地,则输出 No Solution

Input

第一行,lns="http://www.w3.org/1998/Math/MathML">D_1lns="http://www.w3.org/1998/Math/MathML">Clns="http://www.w3.org/1998/Math/MathML">D_2lns="http://www.w3.org/1998/Math/MathML">Plns="http://www.w3.org/1998/Math/MathML">N

接下来有 lns="http://www.w3.org/1998/Math/MathML">N 行。

第 lns="http://www.w3.org/1998/Math/MathML">i+1 行,两个数字,油站 lns="http://www.w3.org/1998/Math/MathML">i 离出发点的距离 lns="http://www.w3.org/1998/Math/MathML">D_i 和每升汽油价格 lns="http://www.w3.org/1998/Math/MathML">P_i

Output

所需最小费用,计算结果四舍五入至小数点后两位。如果无法到达目的地,则输出 No Solution

Sample Input Copy

275.6 11.9 27.4 2.8 2
102.0 2.9
220.0 2.2

Sample Output Copy

26.95

HINT

,其余数字 lns="http://www.w3.org/1998/Math/MathML">\le 500

NOIP1999 普及组第三题、提高组第三题