-
15649 N과 M(1)카테고리 없음 2022. 11. 4. 13:27
https://www.acmicpc.net/problem/15649
15649번: N과 M (1)
한 줄에 하나씩 문제의 조건을 만족하는 수열을 출력한다. 중복되는 수열을 여러 번 출력하면 안되며, 각 수열은 공백으로 구분해서 출력해야 한다. 수열은 사전 순으로 증가하는 순서로 출력해
www.acmicpc.net
n,m = map(int, input().split()) result = [] def back(): if len(result) ==m: print(" ".join(map(str, result))) return for i in range(1,n+1): if i not in result: result.append(i) back() result.pop() back()