RYIP在线题库
首 页   >   习题练习   >   提交
Problem1924--连续最大和

1924: 连续最大和

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 128 MB

【 Description 】

给定一个整数序列 a1,a2,…,an,求这个序列中的一个连续子序列,使得这个序列中的数的和最大


【 Input 】

第一行,一个整数 n 。
第二行,n 个整数,a1、a2...an 。

【 Output 】

 一行,一个整数,表示你所求的最大的和。


【 Sample Input 】

8
3 -6 -8 4 7 -5 5 2

【 Sample Output 】

13

【HINT】

数据范围:n<=500000,序列中所有数的绝对值均不超过 1000。

【 Source/Category 】