import java.text.DecimalFormat;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int number = sc.nextInt();//人数
double avg = 0;//平均数
double sum = 0;//总数
int[] scores = new int[number];
for (int i = 0; i < number; i++) {
int score = sc.nextInt();
scores[i] = score;
sc.nextLine();
}
//升序排序
Arrays.sort(scores);
//求总和
for(int score : scores) {
sum += score;
}
//取小数点后两位
DecimalFormat dfa = new DecimalFormat("0.00");
avg = sum / scores.length;
System.out.println(scores[scores.length - 1]);
System.out.println(scores[0]);
System.out.println(dfa.format(avg));
}
}
P8717 [蓝桥杯 2020 省 AB2] 成绩分析
最新推荐文章于 2024-10-08 15:07:49 发布