0_0_24577797_15482\Main.java:1: 错误: 类Main1003是公共的, 应在名为 Main1003.java 的文件中声明
import java.util.Scanner; public class Main1003 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int T, N, num, startP = 1, endP = 1; T = in.nextInt(); int m = T; while (T-- > 0) { int max = -1001, temp = 1, sum = 0; N = in.nextInt(); for (int i = 1; i <= N; i++) { num = in.nextInt(); sum += num; if (sum > max) { max = sum; startP = temp; endP = i; } if (sum < 0) { sum = 0; temp = i + 1; } } System.out.println("Case " + (m - T) + ":"); System.out.println(max + " " + startP + " " + endP); if (T != 0) { System.out.println(""); } } } }
^
1 个错误
|