[파이썬][백준 10797번] 10부제
1. 문제Permalink
[Bronze IV] 10부제 - 10797Permalink
성능 요약Permalink
메모리: 30840 KB, 시간: 68 ms
분류Permalink
구현(implementation)
출처: 백준, https://https://www.acmicpc.net/
2. 해결방법 시간복잡도Permalink
- 단순 코딩 O(N)
3. 문제 해결 및 코드Permalink
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
N = int(input()) | |
A = map(int, input().split()) | |
sum = 0 | |
while N in A: | |
sum += 1 | |
print(sum) |
-
주석을 참고하면서 이해를 돕습니다.Permalink
4. 알고리즘 및 해설Permalink
- 받아야 할 값들을 N과 A에 받는다. 이때 A는 리스트 형태로 받아진다.
- while문을 통해 받은 N값이 A에 있다면 카운트해준다.
5. 짚고 넘어가기Permalink
- 리스트나 딕셔너리등 값이 내부에 있는 것을 확인할 때 A in B 를 사용해준다.