ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Турниры > CEN303 2013-15 Questions > задача:


14-Fall2-50. 50681 - Center of a Series

CEN303 2013-15 Questions

Старт: 15.дек.2013 в 14:00:00
Финиш: 15.дек.2013 в 19:00:00
Турнир завершён!
• Турнирная таблица

Гость
• Вопросы к жюри (1)

Задачи турнира

• 14-Fall1-30. 50771 - BST Level Sum
• 14-Fall1-40. 50683 - Te Parkojme A...
• 14-Fall1-50. 50770 - Average Depth
• 14-Fall1-60. 50784 - Top Growing C...
• 14-Fall2-10. 50751 - The biggest Mi...
• 14-Fall2-20. 50794 - Writing Files Int...
• 14-Fall2-30. 50490 - Across the River
• 14-Fall2-40. 50772 - The Path of a N...
• 14-Fall2-50. 50681 - Center of a...
• 14-FallResit-10. 50525 - Ordering Pizza
• 14-FallResit-20. 50488 - Connecting...
• 15FE-01. 50851 - Repeated Numbers
• 15FE-01. 50838 - Balanced Numbers
• 15FE-04. 50997 - Dynamic Knights
• 15HW-10. 50826 - Olive Containers
• 15HW-30. 50828 - Arranging Time ...
• 15HW-40. 50676 - Cinema Millennium

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
13-11-4.

Center of a Series

Weight center of a series of numbers where the difference between sum of left side and sum of right side elements is the minimum.

Question: Write a program that is going to read n positive integers and decide the weight center of the series.
Note: The order of elements are not changed, just the difference between sum of left and right sides of every element is calculated.

Example: If you have the following list:
  10 9 4 15 8 2 2 5 2 5
If you take the 5th element (8) as the weight center of the list.

  • Sum of the numbers on the left of it is 38
  • Sum of the numbers on the right of it is 16
giving the difference 22. If you take 4th element (15) as the weight center of the list.
  • Sum of the numbers on the left of it is 23
  • Sum of the numbers on the right of it is 24
giving the minimum difference (1).

Input specification
There is one number (n) at the begining representing the number of numbers in the list (lst) where 1 ≤ n ≤ 100000. and 1 ≤ lsti ≤ 10000. Then in the following lines you have n numbers (at most 1000 numbers per line).

Output specification
Show the position of weight center of the list. Note: Element positions in the list starts from 1.

Sample Input I
  9
  3 9 5 8 4 4 1 7 2
Sample Input II
  6
  7 5 10 5 8 2
Sample Output I
  4
Sample Output II
  3


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

www.contester.ru