6085: 最大部分和

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:29 Solved:17

Description

有n个整数(1≤n≤100),排成一排,例如,n=7时有数列中有七个整数 -2  13  12  9  14  -10  2  ,其最大的部分和为 48 (即 13+12+9+14)。现给出数组,要求最大连续部分和。

Input

n 第一行一个整数 n
 第二行n个用空格隔开的整数,x1  x2 …… xn (-100≤xi≤100)。

Output

包含一行,包括一个整数(即最大的连续的部分和)。

Sample Input Copy

7
 -2  13  12  9  14  -10  2 

Sample Output Copy

48

Source/Category