题目
图片:
代码
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int trees = scanner.nextInt();
int times = scanner.nextInt();
scanner.nextLine();
int T = 0;
int k = 0;
int P = 0;
int kkk = 0;
for (int i = 0; i < trees; i++) {
String arg = scanner.nextLine();
String[] cc = arg.trim().split(" ");
int eachCount = Integer.parseInt(cc[0]);
int kk = 0;
for (int j = 0; j < times; j++) {
kk += Integer.parseInt(cc[j + 1]);
}
T += eachCount + kk;
if (-kk > kkk) {
kkk = -kk;
k = i + 1;
P = -kk;
}
}
String result = T + " " + k + " " + P;
System.out.print(result);
}