Skip to content

Commit 22d2fdc

Browse files
committed
solve: 10816 숫자 카드 2
1 parent 12a04eb commit 22d2fdc

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
"""
3+
문제 이름: 숫자 카드 2
4+
문제 번호: 10816
5+
문제 링크: https://www.acmicpc.net/problem/10816
6+
난이도: Silver IV
7+
태그: 이분 탐색, 자료 구조, 해시를 사용한 집합과 맵, 정렬
8+
"""
9+
import sys
10+
from collections import defaultdict
11+
12+
13+
def input(): return sys.stdin.readline().rstrip()
14+
15+
16+
N = int(input())
17+
18+
cards = map(int, input().split())
19+
dic = defaultdict(int)
20+
21+
for n in cards:
22+
dic[n] += 1
23+
24+
M = int(input())
25+
nums = map(int, input().split())
26+
27+
for n in nums:
28+
print(dic[n], end=" ")
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
file: "10816.md"
3+
name: "숫자 카드 2"
4+
src: "https://www.acmicpc.net/problem/10816"
5+
tags:
6+
- 이분 탐색
7+
- 자료 구조
8+
- 해시를 사용한 집합과 맵
9+
- 정렬
10+
done: true
11+
draft: false
12+
level: 7
13+
difficulty: "Silver IV"
14+
date: 2021-11-12
15+
---
16+
17+
# 숫자 카드 2
18+
19+
## 풀이 코드
20+
21+
```python
22+
import sys
23+
from collections import defaultdict
24+
25+
26+
def input(): return sys.stdin.readline().rstrip()
27+
28+
29+
N = int(input())
30+
31+
cards = map(int, input().split())
32+
dic = defaultdict(int)
33+
34+
for n in cards:
35+
dic[n] += 1
36+
37+
M = int(input())
38+
nums = map(int, input().split())
39+
40+
for n in nums:
41+
print(dic[n], end=" ")
42+
```

0 commit comments

Comments
 (0)