import java.util.Arrays; import java.util.Comparator; import java.util.Scanner; import java.util.TreeMap; class Stu{ int Id; int Chinese; int Score; public Stu(int Id,int Chinese,int Score){ this.Id= Id; this.Chinese=Chinese; this.Score=Score; } } public class Main{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); Stu[]s=new Stu[n]; for (int i =0; i<n ; i++) { int ch=sc.nextInt(); s[i]=new Stu(i+1,ch,ch+sc.nextInt()+sc.nextInt()); } Arrays.sort(s,new Comparator<Stu>(){ @Override public int compare(Stu o1, Stu o2) { if(o1.Score!=o2.Score)return o2.Score-o1.Score; else if(o1.Chinese!=o2.Chinese)return o2.Chinese-o1.Chinese; return o1.Id-o2.Id; } }); for (int i = 0; i < (s.length>5?5:s.length) ; i++) { System.out.println(s[i].Id+" "+s[i].Score); } } }
0.0分
2 人评分
C二级辅导-阶乘数列 (C语言代码)浏览:736 |
C语言程序设计教程(第三版)课后习题11.8 (C语言代码)浏览:910 |
三角形 (C++代码)递推浏览:825 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:645 |
A+B for Input-Output Practice (VI) (C语言代码)浏览:575 |
1054题解浏览:516 |
IP判断 (C语言代码)浏览:592 |
判定字符位置 (C++代码)浏览:733 |
用getchar()函数接收字符,正序输入为什么会倒序输出浏览:767 |
C语言训练-求车速 (C语言代码)浏览:850 |