#P2889. [USACO07NOV] Milking Time S
[USACO07NOV] Milking Time S
Description
Bessie can produce milk in the next hours. For convenience, we number these hours .
Within these hours, FJ has intervals during which he can milk Bessie. The -th interval runs from to and yields gallons of milk.
After each milking, Bessie must rest for hours before FJ can start the next milking.
Now, FJ needs you to compute the maximum total milk Bessie can produce within these hours.
Input Format
The first line contains three integers, representing , , and .
Lines : the -th line contains three integers , , and , describing one milking interval.
Output Format
Output a single integer on one line: the answer.
12 4 2
1 2 8
10 12 19
3 6 24
7 10 31
43
Hint
Constraints
For all testdata, it is guaranteed that , , , and .
Translated by ChatGPT 5
京公网安备 11011102002149号