#P2918. [USACO08NOV] Buying Hay S
[USACO08NOV] Buying Hay S
[USACO08NOV] Buying Hay S
题目描述
Farmer John is running out of supplies and needs to purchase pounds of hay for his cows.
He knows hay suppliers conveniently numbered . Supplier i sells packages that contain pounds of hay at a cost of 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 pounds of hay.
输入格式
* Line : Two space-separated integers: and
* Lines : Line contains two space-separated integers: and
输出格式
* Line : A single integer representing the minimum cost FJ needs to pay to obtain at least pounds of hay.
样例
样例 #1
输入 #1
2 15
3 2
5 3
输出 #1
9
提示
FJ can buy three packages from the second supplier for a total cost of .