题解 | #公务员面试#

公务员面试

https://www.nowcoder.com/practice/f3a134908d5b41869f14f58307008a97

import java.util.Scanner;

import java.util.Arrays;
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int[] score = new int[7];
      while(sc.hasNext()){
        for (int i = 0;i<7;i++){
            score[i] = sc.nextInt();
        }
        //排序
        Arrays.sort(score);
        double avg = (score[1]+score[2]+score[3]+score[4]+score[5])/5.0;
        System.out.printf("%.2f\n",avg);
      }
    }
}

全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务