문제
Problem 2: Optimal Milking [Brian Dean, 2013]
Farmer John has recently purchased a new barn containing N milking machines
Milking machine i is capable of extracting M(i) units of milk per day
Farmer John is interested in computing the maximum amount of milk he can extract over a series of D days
PROBLEM NAME: optmilk
입력
* Line 1: The values of N and D.
* Lines
* Lines
출력
* Line 1: The maximum total amount of milk FJ can produce over D days.
예제1
53
1
2
3
4
5
5 2
2 7
1 10
32
Input Details
There are 5 machines, with initial milk outputs 1,2,3,4,5. On day 1, machine 5 is updated to output 2 unit of milk, and so on.
Output Details
On day one, the optimal amount of milk is 2+4 = 6 (also achievable as 1+3+2). On day two, the optimal amount is 7+4 = 11. On day three, the optimal amount is 10+3+2=15.