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

Разделы > Динамическое программирование > задача:


51010 - Max Sequential Sum

Задачи раздела

• 50677 - The Cottage
• 50675 - Kruja Boys
• 50679 - Jetpack Hurdle Jumping
• 50673 - DNA Testing
• 50997 - Dynamic Knights
• 50936 - Saving the Soldiers
• 50979 - Minimum access cost for BST
• 51062 - Fish Pond II
• 51010 - Max Sequential Sum
• 51072 - Castle on chessboard
• 51075 - Shortest Path for Bishop
• 50688 - Epoka Furgon
• 50524 - Elevator
• 50536 - Epoka Furgon Shpk
• 50687 - Pascal Triangle - 2
• 50689 - The biggest building block
• 50686 - The Container

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

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

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Question by Ibrahim Mesecan.

51010 - Max Sequential Sum

In computer science, the maximum sequential sum problem is the task of finding the contiguous series of numbers within a one-dimensional array which has the largest sequential sum. For example, if the largest sequential sum is asked for the sequence of values -2, 1, -3, 4, -1, 2, 1, -5, 4. the contiguous subarray with the largest sum is 4, -1, 2, 1, with the sum 6.

Write a program that reads a sequence of integers, (with positive and negative values), and defines the max sequential sum.

Input specification
You will be given n space-separate positive or negative integers. where 2 ≤ n ≤ 100,000 and the numbers in the sequence are between -1500 and 1500.

Output specification
Show one integer, the max sequential sum.

Sample Input I
11
-2 1 -3 4 -1 2 -1 5 -7 -6 4      


Sample Input II
11
3 -5 -3 0 1 -1 9 3 -7 10 -17

Sample Output I
9
Sample Output II
15

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

www.contester.ru