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
반응형

+ Recent posts