import sys
num_count = int(input())
array = list()
for _ in range(num_count):
array.append(int(sys.stdin.readline()))
result = sorted(reverse=True)
for item in result:
print(item)
import sys
num_count = int(input())
array = list()
nums_under_5000 = list()
nums_over_5000 = list()
for _ in range(num_count):
num = int(sys.stdin.readline())
if num < 5000:
nums_under_5000.append(num)
else:
nums_over_5000.append(num)
for num in sorted(nums_over_5000, reverse=True):
print(num)
for num in sorted(nums_under_5000, reverse=True):
print(num)
*나의 풀이
import sys
num_count = int(input())
result = [0 for x in range(10001)]
for _ in range(num_count):
num = int(sys.stdin.readline())
result[num] += 1
for i in range(0, 10001):
for _ in range(result[i]):
print(i)
계수 정렬(Couting Sort) 알고리즘
import sys
n = int(sys.stdin.readline())
array = [0] * 10001
for i in range(n):
data = int(sys.stdin.readline())
array[data] += 1
for i in range(10001):
if array[i] !=0 :
for j in range(array[i]):
print(i)