-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathDANH SÁCH THI ICPC
More file actions
52 lines (46 loc) · 1.33 KB
/
Copy pathDANH SÁCH THI ICPC
File metadata and controls
52 lines (46 loc) · 1.33 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
52
import java.util.*;
class ThiSinh implements Comparable<ThiSinh> {
String ten;
String ma;
String ct;
static int id = 1;
ThiSinh(String ten, String ct) {
this.ten = ten;
this.ct = ct;
this.ma = String.format("C%03d", id++);
}
@Override
public int compareTo(ThiSinh o) {
return this.ten.compareTo(o.ten);
}
@Override
public String toString() {
return ma + " " + ten + " " + ct;
}
}
public class Lazygarde {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
ArrayList<String> list = new ArrayList<String>();
sc.nextLine();
for (int i = 0; i < n; i++) {
list.add(sc.nextLine() + " " + sc.nextLine());
}
n = sc.nextInt();
sc.nextLine();
ArrayList<ThiSinh> list2 = new ArrayList<ThiSinh>();
for (int i = 0; i < n; i++) {
String s = sc.nextLine();
String ma = sc.nextLine();
int m = ma.length();
int k = (ma.charAt(m - 2) - '0') * 10 + (ma.charAt(m - 1) - '0') - 1;
list2.add(new ThiSinh(s, list.get(k)));
}
Collections.sort(list2);
for (ThiSinh thiSinh : list2) {
System.out.println(thiSinh);
}
sc.close();
}
}