1003超出时长

import java.util.Scanner;

public class Main{

public static void main(String[] args){

Scanner input = new Scanner(System.in);

int n = input.nextInt();

int temp = 0;

int start = 0;

int end = 0;

for(int i = 0; i < n; i ++){

int m = input.nextInt();

int[] myList = new int [100000];

for(int p = 0; p < m; p++ ){

myList[p] = input.nextInt();

}

int max = myList[0];

for( int j = 0; j < m; j++ ){

temp = myList[j];

for(int k = j+1; k < m; k++){

temp += myList[k];

if(max < temp){

max = temp;

start = j+1;

end = k+1;

}

}

}

System.out.println("case "+(i+1)+":");

System.out.println(max + " " + start + " " + end);

for( int l = 0; l < m; l++){

myList[l] = 0;

}

}

input.close();

}

}

你可能感兴趣的:(1003超出时长)