1635: The Max Sub_Sum

内存限制:128 MB 时间限制:1.000 S
评测方式:文本比较 命题人:
提交:8 解决:1

题目描述

Given an array of positive and negative integers, a Sub_Sum is the sum of consecutive integers with arbitrary length (greater than 0 at least) in the array. Your task: Find the max Sub_Sum of an array of integers

输入

The input consists of serval test cases. Every case consists of two lines: The first line consists of only a postive integer N(1<=N<=100) which tells the lenth of the array; The second line consists of N integers. The value of the number in the array will have magnitude at least 0 and be within the range [0,10^1000]. A line consists of only a zero means the end of input.

输出

Output the max Sub_Sum of each test case, one for a line

样例输入 复制

3
1 1 1
4
1 2 1 3
0

样例输出 复制

3
7