문제link: https://www.acmicpc.net/problem/156491부터 N까지의 자연수 중 M개를 중복 없이 골라 나열하는 법을 모두 출력하는 문제이다. 접근파이썬의 itertools 라이브러리를 활용하면 쉽게 계산할 수 있다. permutations()로 수열을 모두 구한 후 for문으로 순회하며 출력해주었다. 코드import sysfrom itertools import permutationsinput = sys.stdin.readlineN, M = map(int, input().split())l = [x for x in range(1, N+1)]P = permutations(l, M)for p in P: print(' '.join(map(str, p)))