-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJ05030.java
More file actions
51 lines (43 loc) · 1.42 KB
/
Copy pathJ05030.java
File metadata and controls
51 lines (43 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import java.util.*;
class BangDiem {
private String msv;
private String ten;
private String lop;
private Double d1, d2, d3;
public BangDiem(String msv, String ten, String lop, Double d1, Double d2, Double d3) {
this.msv = msv;
this.ten = ten;
this.lop = lop;
this.d1 = d1;
this.d2 = d2;
this.d3 = d3;
}
public String getMsv() {
return msv;
}
public String toString() {
return msv + " " + ten + " " + lop + " " + String.format("%.1f", d1) + " " + String.format("%.1f", d2) + " " + String.format("%.1f", d3);
}
}
public class J05030 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
sc.nextLine();
ArrayList<BangDiem> a = new ArrayList<>();
for (int i = 1; i <= t; i++) {
BangDiem x = new BangDiem(sc.nextLine(), sc.nextLine(), sc.nextLine(), sc.nextDouble(), sc.nextDouble(), sc.nextDouble());
a.add(x);
sc.nextLine();
}
Collections.sort(a, new Comparator<BangDiem>() {
@Override
public int compare(BangDiem o1, BangDiem o2) {
return o1.getMsv().compareTo(o2.getMsv());
}
});
for (int i = 1; i <= t; i++) {
System.out.println(i + " " + a.get(i - 1));
}
}
}