#P2381. 圆圆舞蹈
圆圆舞蹈
Description
Grandma Xiong’s cows have formed a circle in clockwise order. Because they lack strict training, the gaps between adjacent cows are unequal.
The cows want to know how far apart the farthest pair of cows are. The distance from cow to cow is defined as the shorter of the clockwise path and the counterclockwise path from to . Given the distances between adjacent cows, please compute the maximum distance between any two cows.
Input Format
The first line contains an integer , the number of cows, .
The next lines each contain one integer. For , line contains , the clockwise distance from cow to cow , where , and the sum of all distances is .
Line contains the clockwise distance from cow to cow .
Output Format
Output one line containing the maximum distance.
5
1
2
3
4
5
7
Hint
Translated by ChatGPT 5
京公网安备 11011102002149号