[Login|Register]
Problems

Status

Rank

Problem 1179
最大值
Time Limit: 1000ms
Memory Limit: 65536kb
Description
给你一个数列a[1],a[2],a[3]......a[n],你的任务是找出连续元素和的最大值,例如给你{9, -12, 120, 8, -20, 100, 30, -89, 20},那么结果238=120 + 8 + ( -20) + 100 + 30
Input
输入包含多组数据. 每组数据第一行是一个整数n (1≤n≤50),表示接下来你要输入的数列中元素个数 第二行是n个整数,表示数列的元素
Output
输出连续元素和的最大值。
Sample Input
9
9 -12 120 8 -20 100 30 -89 20
3
1 2 3
Sample Output
238
6
University of Science and Technology of China
Online Judge for ACM/ICPC
Processed in 0.9ms with 1 query(s).