File tree Expand file tree Collapse file tree 4 files changed +133
-0
lines changed Expand file tree Collapse file tree 4 files changed +133
-0
lines changed Original file line number Diff line number Diff line change 112
112
| # | ☆ | Problem | Note |
113
113
| :-: | :-: | :----------------------------------------------------- | :--- |
114
114
| 01 | | [ Baekjoon-2839 설탕 배달] ( ./src/Greedy/P2839 ) | |
115
+ | 02 | | [ JUNGOL-1828 냉장고] ( ./src/Greedy/jo1828 ) | |
115
116
116
117
## Data Structure
117
118
Original file line number Diff line number Diff line change
1
+ package Greedy .jo1828 ;
2
+
3
+ import java .io .*;
4
+ import java .util .*;
5
+
6
+ public class Main {
7
+
8
+ static int N ;
9
+ static int [][] temp ;
10
+
11
+ public static void main (String [] args ) throws Exception {
12
+ System .setIn (new FileInputStream ("src/Greedy/jo1828/input.txt" ));
13
+ BufferedReader br = new BufferedReader (new InputStreamReader (System .in ));
14
+
15
+ N = Integer .parseInt (br .readLine ());
16
+ temp = new int [N ][2 ];
17
+ for (int i = 0 ; i < N ; i ++) {
18
+ StringTokenizer st = new StringTokenizer (br .readLine ());
19
+ temp [i ][0 ] = Integer .parseInt (st .nextToken ());
20
+ temp [i ][1 ] = Integer .parseInt (st .nextToken ());
21
+ }
22
+
23
+ Arrays .sort (temp , ((o1 , o2 ) -> o1 [1 ]-o2 [1 ]));
24
+ int i = 0 , j = 1 , cnt = 1 ;
25
+ while (j < N ) {
26
+ if (temp [j ][0 ] > temp [i ][1 ]) {
27
+ cnt ++;
28
+ i = j ;
29
+ }
30
+ j ++;
31
+ }
32
+
33
+ System .out .println (cnt );
34
+ }
35
+ }
Original file line number Diff line number Diff line change
1
+ ## [ JUNGOL-1828] 냉장고
2
+
3
+ ![ image] ( https://user-images.githubusercontent.com/22045163/108316778-b52b1c80-7200-11eb-9849-3f9b3aab0c8b.png )
4
+
5
+ ![ image] ( https://user-images.githubusercontent.com/22045163/108316806-bf4d1b00-7200-11eb-8ce1-a026c455d2c7.png )
Original file line number Diff line number Diff line change
1
+ 91
2
+ 3 5
3
+ 12 37
4
+ 16 23
5
+ 140 143
6
+ 437 522
7
+ 55 95
8
+ 608 2898
9
+ 4614 5026
10
+ 5729 9521
11
+ 0 0
12
+ 0 6
13
+ 4 25
14
+ -24 15
15
+ 112 297
16
+ 480 603
17
+ 52 733
18
+ 1712 2578
19
+ 593 2453
20
+ 695 769
21
+ 0 0
22
+ -9 0
23
+ 7 22
24
+ 23 73
25
+ -161 113
26
+ 152 454
27
+ 193 778
28
+ 827 2057
29
+ 1287 7767
30
+ 2439 2794
31
+ 0 0
32
+ 1 3
33
+ -42 10
34
+ 18 39
35
+ 230 269
36
+ 86 339
37
+ 210 817
38
+ 2673 3451
39
+ 3054 3717
40
+ 4176 4969
41
+ 0 0
42
+ -3 1
43
+ -43 37
44
+ 52 54
45
+ 76 202
46
+ 258 553
47
+ 51 647
48
+ 2066 2387
49
+ 3100 4254
50
+ 2391 7004
51
+ 0 0
52
+ 0 2
53
+ -49 21
54
+ -73 58
55
+ 161 217
56
+ 423 651
57
+ 316 682
58
+ 345 2107
59
+ 2454 6382
60
+ 5106 9322
61
+ 0 0
62
+ -9 7
63
+ 48 49
64
+ -36 3
65
+ -122 110
66
+ 635 710
67
+ 220 292
68
+ 2013 3319
69
+ 4155 6749
70
+ 2609 9557
71
+ 0 0
72
+ 3 7
73
+ 2 12
74
+ -94 62
75
+ 318 368
76
+ 412 665
77
+ 591 800
78
+ 810 1967
79
+ 3365 4434
80
+ 3019 3715
81
+ 0 0
82
+ 2 3
83
+ 14 26
84
+ 49 54
85
+ 329 364
86
+ 174 370
87
+ 766 878
88
+ 68 2986
89
+ 3920 6792
90
+ 832 5078
91
+ 0 0
92
+ -9 4
You can’t perform that action at this time.
0 commit comments