February 03, 2021
3
15
27
12
# 27 15 12
n = int(input())
_list = [int(input()) for _ in range(n)]
_list.sort(reverse=True)
for x in _list:
print(x, end=" ")
2
홍길동 95
이순신 77
# 이순신 홍길동
n = int(input())
_list = []
for x in range(n):
n, m = input().split()
_list.append((n, int(m)))
_list.sort(key=lambda x: x[1])
for x in _list:
print(x[0], end=" ")
5 3
1 2 5 4 3
5 5 6 6 5
# 26
n, k = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
b = list(map(int, input().split()))
b.sort(reverse=True)
for i in range(k):
if a[i] < b[i]:
a[i], b[i] = b[i], a[i]
else:
break
print(sum(a))
Source