AtCoder Beginner Contest 204
翻译中…
Problem Statement
翻译中…
Takahashi is going to cook $N$ dishes called Dish $1$ through $N$.
翻译中…
Dish $i$ can be cooked by using an oven for $T_i$ 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 $N$ dishes? Assume that all processes other than using ovens take negligible time.
翻译中…
Constraints
翻译中…
$1 \leq N \leq 100$$1 \leq T_i \leq 10^3$- All values in input are integers.
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
N
T_1 \ldots T_N
翻译中…
Output
翻译中…
Print the answer.
翻译中…
样例
Input #1
5
8 3 7 2 5
Output #1
13
We can, for example, use the two ovens as follows to cook all the dishes in $13$ minutes.
- The first oven: Cook Dishes $5$ and $1$ in this order.
- The second oven: Cook Dishes $2$, $4$, and $3$ in this order.
Input #2
2
1000 1
Output #2
1000
Input #3
9
3 14 15 9 26 5 35 89 79
Output #3
138
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。