Baekjoon-1038-감소하는 수
23 Sep 2022시간 계산을 미리 해보고 시작하자.
from itertools import combinations
N = int(input())
num = []
for i in range(1,11): # O(10)
for comb in combinations(range(10),i): # maximum O(10C5) = O(112)
comb = list(comb)
comb = sorted(comb, reverse=True) # maximum n^2=O(100)
num.append(int("".join(map(str,comb))))
# O(1e5) -> Brute-force
num = sorted(num)
if len(num)-1 < N:
print(-1)
else:
print(num[N])