#abc204d. D - Cooking
D - Cooking
Score : points
问题陈述
高桥打算烹饪 道菜肴,分别命名为第 1 道至第 道菜肴。
第 道菜肴需要连续使用烤箱 分钟才能完成。同一时间,烤箱不能用于烹制两道或更多菜肴。
如果高桥有两台烤箱可用,那么他最少需要多少分钟来烹制完全部 道菜肴?假设除了使用烤箱之外的所有过程所花费的时间均可忽略不计。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
Takahashi is going to cook dishes called Dish through .
Dish can be cooked by using an oven for consecutive minutes. An oven cannot be used for two or more dishes simultaneously.
If Takahashi has two ovens to use, what is the shortest number of minutes needed to cook all the dishes? Assume that all processes other than using ovens take negligible time.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
5
8 3 7 2 5
Sample Output 1
13
We can, for example, use the two ovens as follows to cook all the dishes in minutes.
- The first oven: Cook Dishes and in this order.
- The second oven: Cook Dishes , , and in this order.
Sample Input 2
2
1000 1
Sample Output 2
1000
Sample Input 3
9
3 14 15 9 26 5 35 89 79
Sample Output 3
138
update @ 2024/3/10 09:17:23