折断木棍AI (CI翻译)
Problem Statement
题目描述
AI (CI翻译)There is one stick. This stick has $N-1$ notches, which divide it into $N$ parts.
有一根木棍,上面有 $N-1$ 个刻痕,将木棍分成 $N$ 段。AI (CI翻译)
The lengths of the parts are $L_1,L_2,\dots,L_N$ in order from one end.
从木棍的一端开始,这些部分的长度依次为 $L_1,L_2,\dots,L_N$。AI (CI翻译)
When choosing one notch and breaking the stick there to obtain two sticks, find the minimum possible absolute value of the difference between the lengths of the two resulting sticks.
选择一个刻痕并在该处折断木棍,得到两根木棍。求两根木棍长度之差的绝对值的最小可能值。AI (CI翻译)
Here, the width of a notch can be ignored, and the length of each resulting stick is the sum of the lengths of the parts it contains.
刻痕的宽度可以忽略,每根木棍的长度等于它所包含部分的长度之和。AI (CI翻译)
Constraints
约束条件
AI (CI翻译)$2 \leq N \leq 100$$1 \leq L_i \leq 10^5$- All input values are integers.
$2 \leq N \leq 100$$1 \leq L_i \leq 10^5$- 输入的所有数值均为整数。
Input
输入格式
AI (CI翻译)The input is given from Standard Input in the following format:
输入从标准输入按以下格式给出:AI (CI翻译)
N
L_1 L_2 \dots L_N
N
L_1 L_2 \dots L_NAI (CI翻译)
Output
输出格式
AI (CI翻译)Output the answer.
输出答案。AI (CI翻译)
样例
4
5 2 3 8
2
7
31 41 59 26 53 58 97
51
10
67011 35764 33042 24098 63738 98760 17199 68579 21812 45408
28105
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。