本文共 394 字,大约阅读时间需要 1 分钟。
import java.util.Scanner;public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc=new Scanner(System.in); while(sc.hasNext()) { int n=sc.nextInt(); int []a=new int[n]; for(int i=0;imax) { max=sum; } if(sum<0) { sum=0; } } System.out.println(max); } }}
这优秀的解法啊~尤其是sum<0 这里
我什么时候才能毫不费力地写出这样的解法呢~~~
转载地址:http://vcssi.baihongyu.com/