1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
n,m=map(int,input().split())
s=[]
ans=[]
def dfs():
if len(s)==m:
tmpAns=sorted((map(int,s)))
if tmpAns not in ans :ans.append(tmpAns)
return
for i in range(1, n+1):
if i not in s:
s.append(i)
dfs()
s.pop()
dfs()
for i in ans:
print(*i)
|
cs |
반응형
'python-algorithm' 카테고리의 다른 글
백준 16199 나이 계산하기 (0) | 2022.01.14 |
---|---|
백준 15651 N과 M (3) (0) | 2022.01.10 |
백준 15649 N과 M (1) (0) | 2022.01.10 |
백준 13610 Volta (0) | 2022.01.10 |
백준 14065 Gorivo (0) | 2022.01.10 |
댓글