Advertisement

1007: Maximum Subsequence Sum plus solution sequence count

阅读量:

1007 Maximum Subsequence Sum 25分

Given a sequence of K integers { N​1​​, N​2​​, ..., N​K​​ }. A continuous subsequence is defined to be { N​i​​, N​i+1​​, ..., N​j​​ } where 1≤i≤j≤K. The Maximum Subsequence is the continuous subsequence which has the largest sum of its elements. For example, given sequence \{ -2, 11, -4, 13, -5, -2\}, its maximum subsequence is \{ 11, -4, 13 \} with the largest sum being 20.

Now you are supposed to find the largest sum, together with the first and the last numbers of the maximum subsequence.

Input Specification:

Each input file conta

全部评论 (0)

还没有任何评论哟~