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

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


51010 - Max Sequential Sum

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

• 51021 - Number of Nodes
• 51044 - Number of Trees
• 50876 - He is my cousin
• 50997 - Dynamic Knights
• 50816 - Largest Sum Path
• 50857 - Nine-Stones Game
• 50490 - Across the River
• 50837 - Sum is equal to K
• 51010 - Max Sequential Sum
• 50772 - The Path of a Node
• 50936 - Saving the Soldiers
• 51086 - Top popular student
• 51015 - Student Scholarships
• 50828 - Arranging Time Table
• 50447 - Swimming Contest - 2
• 51072 - Castle on chessboard
• 51082 - Sum is equal to K - 1

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

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