728x90
분석
풀이
import sys
input=sys.stdin.readline
n,m=map(int, input().split())
res=[0]*n
total=0
def dfs(x):
global total
if x==m:
for j in range(m):
print(res[j], end=' ')
total+=1
print()
else:
for i in range(1,n+1):
res[x]=i
dfs(x+1)
dfs(0)
print(total)
728x90