Fare丶梦


私信TA

用户名:126913199

访问量:41159

签 名:

等  级
排  名 237
经  验 6123
参赛次数 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 人评分

新上线《蓝桥杯辅导》课程,近五年的蓝桥杯省赛与国赛真题都有,从读题开始理解题意、梳理思路、实现代码再提交评测全过程,可有效提升获奖比例甚至进国赛!课程介绍、试听请猛击这里

  评论区

  • «
  • »