백준 15651 - N과 M (3) (파이썬)
Updated:
Answer
a, b = map(int, input().split())
def permutations(array, r):
for i in range(len(array)):
if r == 1:
yield [array[i]]
else:
for next in permutations(array, r - 1):
yield [array[i]] + next
c = list(permutations(list(i for i in range(1, a + 1)), b))
for i in c:
print(*i)