jjano20   2년 전

n, m = map(int,input().split())
list = sorted(input().split())
from collections import deque
def dfs(v_list,v_cnt):
    queue=deque([])
    queue.append(  []  )
    while queue:
        current=queue.popleft()
        if len(current)==v_cnt:
            print(*current)
            continue
        for i in range(n):
            if v_list[i] not in current:
                queue.append(  (current+[v_list[i]]))
dfs(list,m)

alswnssl0528   2년 전

input().split()으로 데이터를 받으면 타입이 문자가 됩니다. 

파이썬에서 문자와 숫자의 대소비교는 다릅니다. (https://www.acmicpc.net/board/...)

2번째 줄에서 문자를 숫자로 바꾼 후 정렬해주세요.

댓글을 작성하려면 로그인해야 합니다.