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

Сборники > Data Structures > задача:


51010 - Max Sequential Sum

Задачи сборника

• 51000 - Book Index
• 51076 - Key person
• 51062 - Fish Pond II
• 51067 - Jumping frog
• 51080 - Deepest Point
• 51079 - Key person - 2
• 51021 - Number of Nodes
• 51044 - Number of Trees
• 51010 - Max Sequential Sum
• 51086 - Top popular student
• 51072 - Castle on chessboard
• 51015 - Student Scholarships
• 51082 - Sum is equal to K - 1
• 51020 - Number of nodes removed
• 51023 - Preparing Keyword Index
• 51075 - Shortest Path for Bishop
• 50774 - Hot Potato

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

Если у вас есть предложения или пожелания по работе 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