注意输入和输出的格式, 这是认证时候提交代码
- import java.util.*;
- public class Main {
- public static void main(String[] args) {
- new Main().run();
- }
- public void run() {
- Scanner sc = new Scanner(System.in);
- int n = sc.nextInt();
- int m = sc.nextInt();
- int[][] count = new int[n][m+1];
- for(int i = 0; i <n; i++) {
- for(int j = 0; j < m+1; j++) {
- count[i][j] = sc.nextInt();
- }
- }
- int[] sum = new int[n];
- int[] del = new int[n];
- int allSum = 0;
- for(int i = 0; i < n; i++) {
- sum[i] = count[i][0];
- for(int j = 1; j < m+1; j++) {
- sum[i] += count[i][j];
- }
- del[i] = count[i][0] - sum[i];
- allSum += sum[i];
- }
- int index = 1;
- int max = del[0];
- for(int i = 1; i < n; i++) {
- if(del[i]> max) {
- max = del[i];
- index = i + 1;
- }
- }
- System.out.println(allSum+""+index+" "+max);
- }
- }
来源: http://www.bubuko.com/infodetail-3334994.html