

Time Limit: 2 sec / Memory Limit: 256 MB
配点 : 点
問題文
すぬけくんとアライグマは 枚のカードの山を作りました。カードの山の上から 番目のカードには整数 が書かれています。
枚のカードを分け合うことにしました。 すぬけくんがカードの山の上から何枚かのカードを取ったあと、アライグマは残ったカード全てを取ります。 このとき、すぬけくんもアライグマも 枚以上のカードを取る必要があります。
すぬけくんとアライグマが持っているカードに書かれた数の総和をそれぞれ として、 を最小化したいです。 としてありうる値の最小値を求めなさい。
制約
- は整数
入力
入力は以下の形式で標準入力から与えられる。
出力
答えを出力せよ。
入力例 1Copy
6 1 2 3 4 5 6
出力例 1Copy
1
すぬけくんが上から 枚のカードを、アライグマが残った 枚のカードを取ったとき、 となって、 は となり、これが最小です。
入力例 2Copy
2 10 -10
出力例 2Copy
20
すぬけくんは上から 枚のカードを、アライグマは残った 枚を取るしかありえません。このとき となって、 は となります。
Score : points
Problem Statement
Snuke and Raccoon have a heap of cards. The -th card from the top has the integer written on it.
They will share these cards. First, Snuke will take some number of cards from the top of the heap, then Raccoon will take all the remaining cards. Here, both Snuke and Raccoon have to take at least one card.
Let the sum of the integers on Snuke's cards and Raccoon's cards be and , respectively. They would like to minimize . Find the minimum possible value of .
Constraints
- is an integer.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1Copy
6 1 2 3 4 5 6
Sample Output 1Copy
1
If Snuke takes four cards from the top, and Raccoon takes the remaining two cards, , , and thus . This is the minimum possible value.
Sample Input 2Copy
2 10 -10
Sample Output 2Copy
20
Snuke can only take one card from the top, and Raccoon can only take the remaining one card. In this case, , , and thus .