import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(); int m = input.nextInt(); int[][] arr = new int[n][m + 1]; int sum = 0; for (int i = 0; i < n; i++) for (int j = 0; j < m + 1; j++) { arr[i][j] = input.nextInt(); sum += arr[i][j]; } int[] s = new int[n]; int[] tmp = new int[n]; for (int j = 0; j < n; j++) for (int i = 1; i < m + 1; i++) { s[j] += arr[j][i]; tmp[j] = s[j]; } Arrays.sort(s); int k = 0; for (k = 0; k < n; k++) { if (tmp[k] == s[0]) break; } System.out.printf("%d %d %d", sum, k + 1, Math.abs(s[0])); } }
CSP 201909-1 小明种苹果(Java版)
最新推荐文章于 2023-03-16 17:15:39 发布