import java.util.Scanner; import java.util.Collections; import java.util.Arrays; public class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); Integer[] integers=new Integer[n]; for(int i=0;i<n;i++){ integers[i]=sc.nextInt(); } Arrays.sort(integers,Collections.reverseOrder());//用函数逆向排序,输出前五个即可 for(int i=0;i<5;i++){ System.out.print(integers[i]+" "); } } }