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
|
Для отправки решений необходимо выполнить вход.
|