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
Для отправки решений необходимо выполнить вход.
|