package bigzishuzu;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
int [] num=new int[30];
int n;
int i,j;
int cishu;
int sum;
int max;
max=0;
cishu=0;
System.out.println("请输入数组的个数:");
@SuppressWarnings("resource")
Scanner scan=new Scanner(System.in);
n=scan.nextInt();
int geshu=((1+n)*n)/2;
int [] daxiao=new int[300];
for(i=0;i<n;i++) { //完成数组的的输入
num[i]=scan.nextInt();
}
for(i=0;i<n-0;i++)
{
sum=0;
for(j=i;j<n;j++) {
sum=sum+num[j];
System.out.println("第"+cishu+"个子数组的和为:"+sum);
daxiao[cishu]=sum;
cishu++;
}
}
max=daxiao[0];
for(int l=0;l<geshu;l++) {
if(max<daxiao[l]) {
max=daxiao[l];
}
}
System.out.println("最大子数组和为:"+max);
}
}