102381: [AtCoder]ABC238 B - Pizza
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Score : $200$ points
Problem Statement
We have a circular pizza.
Takahashi will cut this pizza using a sequence $A$ of length $N$, according to the following procedure.
- First, make a cut from the center in the $12$ o'clock direction.
- Next, do $N$ operations. The $i$-th operation is as follows.
- Rotate the pizza $A_i$ degrees clockwise.
- Then, make a cut from the center in the $12$ o'clock direction.
For example, if $A=(90,180,45,195)$, the procedure cuts the pizza as follows.
Find the center angle of the largest pizza after the procedure.
Constraints
- All values in input are integers.
- $1 \le N \le 359$
- $1 \le A_i \le 359$
- There will be no multiple cuts at the same position.
Input
Input is given from Standard Input in the following format:
$N$ $A_1$ $A_2$ $\dots$ $A_N$
Output
Print the answer as an integer.
Sample Input 1
4 90 180 45 195
Sample Output 1
120
This input coincides with the example in the Problem Statement.
The center angle of the largest pizza is $120$ degrees.
Sample Input 2
1 1
Sample Output 2
359
Sample Input 3
10 215 137 320 339 341 41 44 18 241 149
Sample Output 3
170
Input
题意翻译
### 题目描述: 高桥君准备将一个圆形披萨分成 $N$ 份,他将会以以下的方式切割披萨: 一、从圆心往12点方向连一条线,并沿这条线切开。 二、然后重复以下操作 $N$ 次: 1. 将披萨旋转 $a_i$ 度。 2. 从圆心往现在的12点方向连一条线,并沿这条线切开。 请输出切完后角度最大的一块皮 披萨的角度。Output
分数:$200$ 分
问题描述
我们有一个圆形披萨。
- 首先,从中心向 12 点钟方向切一刀。
- 接下来,进行 $N$ 次操作。第 $i$ 次操作如下。
- 将披萨顺时针旋转 $A_i$ 度。
- 然后,从中心向 12 点钟方向切一刀。
例如,如果 $A=(90,180,45,195)$,则切割披萨的过程如下。
求程序结束后,最大的披萨的中心角。
限制条件
- 输入中的所有值都是整数。
- $1 \le N \le 359$
- $1 \le A_i \le 359$
- 不会有两刀切在同一个位置。
输入
输入格式如下:
$N$ $A_1$ $A_2$ $\dots$ $A_N$
输出
打印一个整数作为答案。
样例输入 1
4 90 180 45 195
样例输出 1
120
这个输入与问题描述中的示例相吻合。
最大的披萨的中心角为 $120$ 度。
样例输入 2
1 1
样例输出 2
359
样例输入 3
10 215 137 320 339 341 41 44 18 241 149
样例输出 3
170