2520. Buying Hay

单点时限: 2.0 sec

内存限制: 256 MB

Farmer John is running out of supplies and needs to purchase H (1<= H <= 50,000) pounds of hay for his cows.

He knows N (1 <= N <= 100) hay suppliers conveniently numbered 1..N. Supplier i sells packages that contain P_i (1 <= P_i <= 5,000) pounds of hay at a cost of C_i (1 <= C_i <= 5,000) dollars. Each supplier has an unlimited number of packages available, and the

packages must be bought whole.

Help FJ by finding the minimum cost necessary to purchase at least H pounds of hay.

输入格式

  • Line 1: Two space-separated integers: N and H

  • Lines 2..N+1: Line i+1 contains two space-separated integers: P_i

and C_i

输出格式

  • Line 1: A single integer representing the minimum cost FJ needs to

pay to obtain at least H pounds of hay.

样例

Input
2 15
3 2
5 3
Output
9
OUTPUT DETAILS:
FJ can buy three packages from the second supplier for a total cost of 9.

12 人解决,33 人已尝试。

15 份提交通过,共有 98 份提交。

7.2 EMB 奖励。

创建: 15 年,1 月前.

修改: 6 年,8 月前.

最后提交: 9 月,4 周前.

来源: USACO NOV 2008

题目标签