Python(백준)/정렬
[백준 파이썬 2751번]수 정렬하기2★삽입,버블 정렬 추후에 해보기★우선순위 힙 사용해보기★VER 2.0
goAhEAd_29
2023. 4. 9. 20:25
728x90
반응형
VERSION 2.0
import sys
import heapq
N = int(sys.stdin.readline())
res = []
for i in range(N):
a = int(sys.stdin.readline())
heapq.heappush(res , a)
while res:
print(heapq.heappop(res))
VERSION 1.0
import sys
N = int(sys.stdin.readline())
B =[]
for i in range(N):
N = int(sys.stdin.readline())
B.append(N)
c = sorted(B)
for i in c:
print(i)
sorted 하니깐 그냥 되네?
728x90
반응형