Pizza

AtCoder
IDabc238_b
Time2000ms
Memory256MB
Difficulty
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. ![image](https://img.atcoder.jp/ghi/AWP_pict.png) 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$ [samples]
Samples
Input #1
4
90 180 45 195
Output #1
120

This input coincides with the example in the Problem Statement.  
The center angle of the largest pizza is $120$ degrees.
Input #2
1
1
Output #2
359
Input #3
10
215 137 320 339 341 41 44 18 241 149
Output #3
170
API Response (JSON)
{
  "problem": {
    "name": "Pizza",
    "description": {
      "content": "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",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc238_b"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "We have a circular pizza.  \nTakahashi will cut this pizza using a sequence $A$ of length $N$, according to the following procedure.\n\n*   First, make a cut from the center in the $12$ o'clock direction...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments