-
[백준] 11004 k번째 수백준 Online Judge 2021. 8. 31. 17:14
문제 해설
- n개의 수를 오름차순으로 정렬 한 뒤, k 번째 수를 찾아라.
- 시간 복잡도 o(NlogN)의 정렬 알고리즘을 이용한다.
11004번: K번째 수
수 N개 A1, A2, ..., AN이 주어진다. A를 오름차순 정렬했을 때, 앞에서부터 K번째 있는 수를 구하는 프로그램을 작성하시오.
www.acmicpc.net
n, k = map(int, input().split()) array = list(map(int, input().split())) array = sorted(array) print(array[k-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' 카테고리의 다른 글
[백준] 1302 베스트셀러 (0) 2021.09.14 [백준] 1236 성 지키기 (0) 2021.09.14 [백준] 2751 수 정렬하기 2 (0) 2021.08.31 [백준] ⭐⭐ 7490 0만들기 (0) 2021.08.31 [백준] 1074 z (재귀 함수) (0) 2021.08.31