HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Dynamic programming & Greedy > problem:


51010 - Max Sequential Sum

Section problems

• 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

Feedback

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

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
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