728x90
반응형
SMALL
https://www.acmicpc.net/problem/1764
제출코드
import sys
input = sys.stdin.readline
N, M = map(int, input().strip().split())
N_set = set()
total_list = []
#듣도 못한사람
for _ in range(N):
N_set.add(input().strip())
#보도 못한 사람
for _ in range(M):
name = input().strip()
if name in N_set:
total_list.append(name)
total_list.sort()
print(len(total_list))
for i in total_list:
print(i)
접근방법 및 풀이
이번거는 좀 쉬웠던거 같다.
숫자 카드 문제와 비슷하게 접근하여 풀었다.
※숫자카드 문제풀이
https://seungwon081.tistory.com/52
[백준/Python] - 10815번 숫자 카드
https://www.acmicpc.net/problem/10815 제출코드import sysinput = sys.stdin.readlineN = int(input())N_set = set(map(int, input().split()))M = int(input())M_list = list(map(int, input().split()))res = []for i in M_list: if i in N_set: res.append(1) else:
seungwon081.tistory.com
※회고
작년에 잘 안풀리던 문제들이 다시 풀어보니 잘 풀리는 걸 보아 작년에는 생각없이 풀었던거 같다...
728x90
반응형
LIST
'백준[파이썬]' 카테고리의 다른 글
[백준/Python] - 9012번 괄호 (0) | 2025.04.05 |
---|---|
[백준/Python] - 11478번 서로 다른 부분 문자열의 개수 (0) | 2025.04.02 |
[백준/Python] - 10816 숫자 카드2 (0) | 2025.03.31 |
[백준/Python] - 7785번 회사에 있는사람 (0) | 2025.03.30 |
[백준/Python] - 14425번 문자열 집합 (0) | 2025.03.29 |