Skip to content

Commit 23a6ab4

Browse files
committed
[Hash] baekjoon-1764
1 parent ddc6027 commit 23a6ab4

4 files changed

Lines changed: 47 additions & 1 deletion

File tree

โ€ŽREADME.mdโ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
| 25 | | [Baekjoon-17779 ๊ฒŒ๋ฆฌ๋งจ๋”๋ง 2](./src/Simulation/P17779) | |
6565
| 26 | | [Baekjoon-2564 ๊ฒฝ๋น„์›](./src/Simulation/P2564) | |
6666
| 27 | | [Baekjoon-17144 ๋ฏธ์„ธ๋จผ์ง€ ์•ˆ๋…•!](./src/Simulation/P17144) | |
67-
| 28 | | [SWEA-5656 ๋ฒฝ๋Œ ๊นจ๊ธฐ](./src/Simulation/swea5656) | |
67+
| 28 | โญ๏ธ | [SWEA-5656 ๋ฒฝ๋Œ ๊นจ๊ธฐ](./src/Simulation/swea5656) | |
6868

6969
## String
7070

@@ -258,6 +258,7 @@
258258
| # | โ˜† | Problem | Note |
259259
| :-: | :-: | :----------------------------------------- | :--- |
260260
| 01 | | [Programmers ๋ฒ ์ŠคํŠธ์•จ๋ฒ”](./src/Hash/prg42579) | |
261+
| 02 | | [Baekjoon-1764 ๋“ฃ๋ณด์žก](./src/Hash/P1764) | |
261262

262263
## Graph
263264

โ€Žsrc/Hash/P1764/Main.javaโ€Ž

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package Hash.P1764;
2+
3+
import java.io.*;
4+
import java.util.*;
5+
6+
public class Main {
7+
8+
static int N, M;
9+
static HashMap<String, Integer> map = new HashMap<>();
10+
static List<String> list = new ArrayList<>();
11+
12+
public static void main(String[] args) throws Exception {
13+
System.setIn(new FileInputStream("src/Hash/P1764/input.txt"));
14+
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
15+
StringTokenizer st = new StringTokenizer(br.readLine());
16+
17+
N = Integer.parseInt(st.nextToken());
18+
M = Integer.parseInt(st.nextToken());
19+
20+
for (int i = 0; i < N+M; i++) {
21+
map.merge(br.readLine(), 1, Integer::sum);
22+
}
23+
24+
map.forEach((key, value) -> {
25+
if (value == 2) list.add(key);
26+
});
27+
28+
list.sort(String::compareTo);
29+
System.out.println(list.size());
30+
for (String s : list) System.out.println(s);
31+
}
32+
}

โ€Žsrc/Hash/P1764/README.mdโ€Ž

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## [baekjoon-1764] ๋“ฃ๋ณด์žก
2+
3+
![image](https://user-images.githubusercontent.com/22045163/115133913-acab6280-a046-11eb-89ff-4b14483bb6c0.png)
4+
5+
![image](https://user-images.githubusercontent.com/22045163/115133921-b339da00-a046-11eb-8473-6d78f9918321.png)

โ€Žsrc/Hash/P1764/input.txtโ€Ž

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
3 4
2+
ohhenrie
3+
charlie
4+
baesangwook
5+
obama
6+
baesangwook
7+
ohhenrie
8+
clinton

0 commit comments

Comments
ย (0)