19-09-01(小明种苹果)

import java.util.*;
public class csp_19_09_01 {
public static void main(String[] args) {
	Scanner in = new Scanner(System.in);
	int N = in.nextInt();
	int M = in.nextInt();
	int T=0,K=0,P=0;
	int max_k =0;
	int max_p =0;
	int[][] a = new int[N][M+1];
	for(int i =0;i<N;i++) {
		for(int j=0;j<=M;j++) {
			int temp = in.nextInt();
			a[i][j]  = temp;
			T += temp;
		}
	}
	for(int i =0;i<N;i++) {
		max_p =0;
		for(int j = 1;j<=M;j++) {
			max_p += a[i][j];
		}
		if(P > max_p) {
			K = i+1;
			P = max_p;
		}
	}
	System.out.print(T+" "+K+" "+(-1)*P);
}
}

//3 3
//73 -8 -6 -4
//76 -5 -10 -8
//80 -6 -15 0

上一篇:angular数据共享


下一篇:2.2 什么是命题