#P1016. [NOIP 1999 普及组/提高组] 旅行家的预算

    ID: 16 远端评测题 1000ms 128MiB 尝试: 1 已通过: 1 难度: 5 上传者: 标签>贪心1999递归NOIp 普及组NOIp 提高组

[NOIP 1999 普及组/提高组] 旅行家的预算

Description

A traveler wants to drive a car from one city to another at the minimum cost (assume the fuel tank is empty at the start). Given the distance between the two cities SS, the fuel tank capacity CC (in liters), the distance per liter LL, the price per liter at the starting point P0P_0, and the number of gas stations along the route NN, as well as the distance from the starting point to gas station ii, DiD_i, and the price per liter at gas station ii, Pi (i=1,2,,N)P_i\ (i=1,2,\dots,N), you need to find the minimum cost.

Input Format

The first line contains four real numbers S,C,L,P0S, C, L, P_0 and one integer NN, as described above.

For each of the next NN lines, the (i+1)(i+1)-th line contains two real numbers DiD_i and PiP_i, as described above.

Output Format

Print a single real number, the minimum cost (rounded to two decimal places).

If it is impossible to reach the destination, output No Solution.

275.6 11.9 27.4 2.8 2
102.0 2.9
220.0 2.2

26.95

Hint

Constraints: 0N60 \leq N \leq 6, 0DiS0 \leq D_i \leq S, 0S,C,L,P0,Pi5000 \leq S, C, L, P_0, P_i \leq 500.

NOIP 1999 Junior problem 3, Senior problem 3.

Translated by ChatGPT 5