思路:
保存掉落的苹果总数,和树是第几棵即可
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));
String[] line = buff.readLine().split(" ");
int n = Integer.parseInt(line[0]);
int m = Integer.parseInt(line[1]);
int sum = 0;//总数
int maxCnt = 1;//最大掉落数的下标
int maxSum = 0;//最大掉落数
for ( int i = 1; i <= n; i++ ) {
line = buff.readLine().split(" ");
int temp = Integer.parseInt(line[0]);//当前树的苹果数
int downNum = 0;//掉落的数量
for ( int j = 1; j <= m; j++ ) {
downNum += Integer.parseInt(line[j]);
}
downNum = Math.abs(downNum);
if ( downNum > maxSum ) {
maxSum = downNum;
maxCnt = i;
}
sum += temp-downNum;
}
System.out.println(sum+" "+maxCnt+" "+maxSum);
}
}