-
[백준] 1764 python - 듣보잡(실버 4)알고리즘 문제/다시 풀어볼 것 2022. 10. 26. 12:46
https://www.acmicpc.net/problem/1764
1트
집합 교집합 연산 & 사용가능
unpacking 시 * 사용입력받기
m,a,*b=open(0).read().split()
내풀이
import sys # input_lines = open(0).readlines() n, k = map(int, sys.stdin.readline().rstrip().split()) first_hear = set() first_see = set() for _ in range(n): first_hear.add(sys.stdin.readline().rstrip()) for _ in range(k): first_see.add(sys.stdin.readline().rstrip()) first_hear.intersection_update(first_see) print(len(first_hear)) for person in sorted(first_hear): print(person)
'알고리즘 문제 > 다시 풀어볼 것' 카테고리의 다른 글
[백준] 2606 python - 바이러스(실버 3) (0) 2022.10.27 [백준] 1931 python - 회의실 배정(실버 1) (0) 2022.10.27 [백준] 1697 python - 숨바꼭질(실버 1) (0) 2022.10.26 [백준] 1463 python - 1로 만들기(실버 3) (0) 2022.10.25 [백준] 1074 python - Z(실버 1) (0) 2022.10.24