

n,m = list(map(int,input().split()))
s = []
def dfs():
if len(s)==m:
print(' '.join(map(str,s)))
return
for i in range(1,n+1):
if i not in s:
s.append(i)
dfs()
s.pop()
dfs()
처음 접해보는 알고리즘 기법이라 다른 분의 풀이를 보고 배꼈다.. (🔗)

챗지피티의 설명..
| [파이썬/python] 백준 15651번 : N과 M (3) (🥈3) (0) | 2023.06.11 |
|---|---|
| [파이썬/python] 백준 15650번 : N과 M (2) (🥈3) (0) | 2023.06.11 |
| [파이썬/python] 백준 1436번 : 영화감독 숌 (🥈5) (0) | 2023.06.11 |
| [파이썬/python] 백준 28224번 : Final Price (🥉4) (0) | 2023.06.10 |
| [파이썬/python] 백준 4779번 : 칸토어 집합 (🥈3) (0) | 2023.06.10 |