#P1376. [USACO05MAR] Yogurt factory 机器工厂
[USACO05MAR] Yogurt factory 机器工厂
Description
Xiao T opened a machine factory. Over weeks, raw material costs and labor prices fluctuate; in week , producing one machine costs yuan. If a machine is not sold, maintaining each machine costs yuan per week; this fee is constant.
The factory has received orders: in week , it must deliver machines to the client. Machines produced in week , as well as inventory from previous weeks, can be used to fulfill the order.
Please compute the minimum total cost to complete all orders over these weeks.
Input Format
The first line contains two integers and . The next lines each contain two integers and .
Output Format
Output a single integer, the minimum cost.
4 5
88 200
89 400
97 300
91 500
126900
Hint
For of the testdata, , , , .
Translated by ChatGPT 5
京公网安备 11011102002149号