https://www.acmicpc.net/problem/16496
5
3 30 34 5 9
이러한 배열로 주어졌다면 이 수들을 나열할 때 a + b 중 b + a 더 큰 기준으로 정렬을 해주면 된다.
예를 들어 9 90이 정렬해야하는 수로 오면 990과 909중 990이 더 크기 때문에 9 - 90으로 정렬해준다.
from functools import cmp_to_key
N = int(input())
arr = list(map(str,input().split()))
def compare(x,y):
if x + y < y + x:
return 1
return -1
arr.sort(key=cmp_to_key(compare))
print(int("".join(arr)))