package com.imooc;
import java.util.*;
public class HelloWorld8_1 {
public static void main(String[] args) {
Scanner print=new Scanner(System.in);
int[] scores;
int numPeople=print.nextInt();
System.out.println("请输入班级人数:");
scores=new int[numPeople];
for(int i=0;i<scores.length;i++){
System.out.println("请输入第"+(i+1)+"个学生的成绩:");
int score=print.nextInt();
if(score>=0&&score<=100){
scores[i]=score;
}
}
HelloWorld8_1 hello=new HelloWorld8_1();
hello.ranking(scores);
}
public void ranking(int[] scores){
Arrays.sort(scores);
int j=0;
System.out.println("以下是前三名成绩:");
for(int i=scores.length-1;i>scores.length-4;i--){
j++;
System.out.println("第"+j+"名:"+scores[i]);
}
}
}