#abc340d. D - Super Takahashi Bros.
D - Super Takahashi Bros.
Score: points
问题描述
Takahashi 正在玩一款游戏。
该游戏包含 个阶段,编号为 。最初,只有第 阶段可以进行游戏。
对于每个可以玩的阶段 (),在阶段 上,你可以执行以下两种操作之一:
- 花费 秒来通关阶段 。这将允许你游玩阶段 。
- 花费 秒来通关阶段 。这将允许你游玩阶段 。
忽略除清除阶段所需时间以外的所有时间,最少需要多少秒才能开始游玩阶段 ?
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
Takahashi is playing a game.
The game consists of stages numbered . Initially, only stage can be played.
For each stage ( ) that can be played, you can perform one of the following two actions at stage :
- Spend seconds to clear stage . This allows you to play stage .
- Spend seconds to clear stage . This allows you to play stage .
Ignoring the times other than the time spent to clear the stages, how many seconds will it take at the minimum to be able to play stage ?
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
5
100 200 3
50 10 1
100 200 5
150 1 2
Sample Output 1
350
By acting as follows, you will be allowed to play stage in seconds.
- Spend seconds to clear stage , which allows you to play stage .
- Spend seconds to clear stage , which allows you to play stage .
- Spend seconds to clear stage , which allows you to play stage .
Sample Input 2
10
1000 10 9
1000 10 10
1000 10 2
1000 10 3
1000 10 4
1000 10 5
1000 10 6
1000 10 7
1000 10 8
Sample Output 2
90
Sample Input 3
6
1000000000 1000000000 1
1000000000 1000000000 1
1000000000 1000000000 1
1000000000 1000000000 1
1000000000 1000000000 1
Sample Output 3
5000000000
update @ 2024/3/10 01:33:02