logo AlgoBeat OnlineJudge
登录 注册

#201949. [USACO07NOV] Milking Time S

内存限制:125 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

:::warning{open} This question uses the original question data, but there is a problem with the original question data relative to the question surface. The actual data for this question is . :::


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.

输入格式

The first line contains three integers, representing , , and .

Lines : the -th line contains three integers , , and , describing one milking interval.

输出格式

Output a single integer on one line: the answer.

样例

样例输入 1

12 4 2
1 2 8
10 12 19
3 6 24
7 10 31

样例输出 1

43

数据范围与提示

Constraints

For all testdata, it is guaranteed that , , , and .

Translated by ChatGPT 5