Programming Language Training/Python
Baekjoon Training #1269
생각하는 이상훈
2022. 8. 10. 18:37
728x90
#1269
x,y=map(int,input().split())
a=set(map(int,input().split()))
b=set(map(int,input().split()))
print(len(a-b)+len(b-a))
집합 연산을 손쉽게 진행할 수 있는 set를 이용한 문제이다. 숫자들을 map과 set을 이용하여 set의 원소로 받아온다.
list의 원소의 수를 구해주는 len() 함수를 set에도 이용할 수 있으므로 차집합의 원소의 수를 구하고 더해줘서 출력하였다.
728x90