-
[백준] 1920 수 찾기백준 Online Judge 2021. 8. 26. 20:31
문제 링크
1920번: 수 찾기
첫째 줄에 자연수 N(1 ≤ N ≤ 100,000)이 주어진다. 다음 줄에는 N개의 정수 A[1], A[2], …, A[N]이 주어진다. 다음 줄에는 M(1 ≤ M ≤ 100,000)이 주어진다. 다음 줄에는 M개의 수들이 주어지는데, 이 수들
www.acmicpc.net
문제 해설
- 문제: 주어진 정수 안에 찾는 정수가 존재 하는가?
- 힌트: set 자료형은 중복이 허용되지 않는 집합이다.
- 리스트 []
- 튜플 () 값을 바꿀 수 없다.
- 딕셔너리 {key1:value1, key2:value2,..}
- 집합 set {} 중복값이 없다.
문제 풀이 코드
n = int(input()) array = set(map(int, input().split())) m = int(input()) x = list(map(int, input().split())) for i in x: if i not in array: print('0') else: print('1')
GitHub - DAWUNHAN/Algorithms-and-DataStructure: Algorithms and DataStructure with Python
Algorithms and DataStructure with Python. Contribute to DAWUNHAN/Algorithms-and-DataStructure development by creating an account on GitHub.
github.com
'백준 Online Judge' 카테고리의 다른 글
[백준] 2750 수 정렬 (0) 2021.08.27 [백준] ⭐⭐ 4195 친구 네트워크 (0) 2021.08.26 [백준] 10930 SHA-256 (0) 2021.08.26 [백준] 5397 키로그 (0) 2021.08.25 [백준] 1874 스택 수열 (0) 2021.08.25