第三题可以用一重循环吗?
import java.util.Scanner;
/**
* @date 2019-09-21
*/
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int n = input.nextInt();
int[] res = new int[n];
for (int i = 0; i < n; i++) {
int num = input.nextInt();
int[] t = new int[num];
for (int j = 0; j < num; j++) {
t[j] = input.nextInt();
}
int sum = t[0];
int max = 1;
int l = 1;
for (int j = 1; j < num; j++) {
if (t[j] >= sum) {
l++;
sum += t[j];
} else {
max = Math.max(max, l);
sum = t[j];
l = 1;
}
}
res[i] = Math.max(max,l);
}
for (int r : res) {
System.out.println(r);
}
}
}