Fare丶梦


私信TA

用户名:126913199

访问量:31077

签 名:

等  级
排  名 134
经  验 4890
参赛次数 0
文章发表 50
年  龄 22
在职情况 学生
学  校
专  业

  自我简介:

解题思路:





注意事项:





参考代码:

import java.util.Scanner;


public class Main {

        public static void Two(String[][] array,int N){

                int A = 0;

                int B = 0;

                int C = 0;

                int Num = 0;

                int Sum = 0;

                int M = 0;

                for(int i=0;i<array.length;i++){

                        A += Integer.valueOf(array[i][2]);

                        B += Integer.valueOf(array[i][3]);

                        C += Integer.valueOf(array[i][4]);

                        for(int j=2;j<5;j++){

                                Sum += Integer.valueOf(array[i][j]);

                        }

                        if(Num<Sum){

                                Num = Sum;

                                M=i;

                        }

                        Sum=0;

                }

                System.out.println(A/N+" "+B/N+" "+C/N);

                for(int i=0;i<5;i++){

                        System.out.print(array[M][i]+" ");

                }

        }

        public static void main(String[] arg){

                Scanner sc = new Scanner(System.in);

                int N = sc.nextInt();

                String[][] array = new String[N][5];

                for(int i=0;i<array.length;i++){

                        for(int j=0;j<5;j++){

                                array[i][j] = sc.next();

                        }

                }

                Two(array,N);

        }

}


 

0.0分

0 人评分

  评论区