PROGRAMMING:Maximum subsegment sum
Given the sequence a [1], a [2], a [3],..., a [n] composed of N integers (which may be negative), find the maximum value of the subsegment sum of the sequence such as a [i] + a [i + 1] +... + a [J]. When all the given integers are negative, the sum of sub segments is defined as 0.
The time complexity of the algorithm is O (n).
###Input format:
There are two lines of input:
The first line is n value (1 < = n < = 10000);
The second line is n integers.
###Output format:
Output the maximum number of sub segments and.
###Input example:
Here is a set of inputs. For example:
```in
six
-2 11 -4 13 -5 -2
```
###Output example:
The corresponding output is given here. For example:
```out
twenty
```
answer:If there is no answer, please comment
The time complexity of the algorithm is O (n).
###Input format:
There are two lines of input:
The first line is n value (1 < = n < = 10000);
The second line is n integers.
###Output format:
Output the maximum number of sub segments and.
###Input example:
Here is a set of inputs. For example:
```in
six
-2 11 -4 13 -5 -2
```
###Output example:
The corresponding output is given here. For example:
```out
twenty
```
answer:If there is no answer, please comment