HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Albanian National Olympiads in Informatics > problem:


2012-2. 50545 - Diet

Guest
• Discussion of problem (1)

Volume problems

• 2015-2. 50489 - Football Championship
• 2010-1. 50298 - Coins
• 2010-2. 50299 - Median
• 2010-3. 50300 - Matrix
• 2012-2. 50545 - Diet
• 2013-1. 50591 - Leap year
• 2013-3. 50570 - Prime numbers in t...
• 2013-4. 50958 - ATM
• 2013-5. 50543 - Hotel rooms
• 2013-6. 50562 - List of students
• 2012-1. 50544 - Stock market
• 2012-4. 50680 - Triangle
• 2012-5. 50551 - Camelot

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 4000/7000/7000/7000 ms. Memory limit 65000/65000/65000/65000 Kb.
Olympiad 2012. Prepared by: Evis Hoxha. Difficulty Alpha

Question 2. Diet

Given n values that represent the ups and downs of the weight during some diet days. Positive values represent increase in weight, while negative values represent decrease in weight. Write a program that after reading the values of each day, determines if there exists a day such as the sum of the changes in weight in the previous days is equal to the sum of the changes in weight in the following days.
The sum of changes is calculated by adding the values for each day.

Input

The first line contains the number of days n, where 3<=n<=10000. The second line contains the values for each day.

Output

If a day fulfilling the requirements exists, show the number of the day. If such a day does not exist, show 0.



Input I

10
100 200 -500 200 300 150 350 -600 150 -50

Output 1

5


Explanation:
100+200-500+200=150+350-600+150-50

Для отправки решений необходимо выполнить вход.

www.contester.ru