-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJ07073_DangKyHinhThucGiangDay.java
47 lines (42 loc) · 1.33 KB
/
J07073_DangKyHinhThucGiangDay.java
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
import java.io.*;
import java.math.*;
import java.util.*;
class MonHoc {
public String mmh, tmh, lt, th, stc;
public MonHoc(String mmh, String tmh, String stc, String lt, String th) {
this.mmh = mmh;
this.tmh = tmh;
this.stc = stc;
this.lt = lt;
this.th = th;
}
public boolean thuchanhtructuyen() {
return !this.th.equals("Truc tiep");
}
@Override
public String toString() {
return mmh + " " + tmh + " " + stc + " " + lt + " " + th;
}
}
public class J07073_DangKyHinhThucGiangDay {
public static void main(String[] args) throws FileNotFoundException {
Scanner sc = new Scanner(new File("MONHOC.in"));
int n = sc.nextInt();
sc.nextLine();
ArrayList<MonHoc> a = new ArrayList<>();
for (int i = 1; i <= n; i++) {
a.add(new MonHoc(sc.nextLine(), sc.nextLine(), sc.nextLine(), sc.nextLine(), sc.nextLine()));
}
Collections.sort(a, new Comparator<MonHoc>() {
@Override
public int compare(MonHoc t, MonHoc t1) {
return t.mmh.compareTo(t1.mmh);
}
});
for (MonHoc mh : a) {
if (mh.thuchanhtructuyen()) {
System.out.println(mh);
}
}
}
}