[백준/Python(파이썬)] 10974 모든 순열
2021-01-28 문제 : https://www.acmicpc.net/problem/10974 10974번: 모든 순열 N이 주어졌을 때, 1부터 N까지의 수로 이루어진 순열을 사전순으로 출력하는 프로그램을 작성하시오. www.acmicpc.net 이거는 풀었다고 하기도 민망하다 앞 문제에 시간을 너무 많이 써서 간단한거 풀었음 n이 최대 8까지여서 permutations 사용해도 충분히 시간안에 가능함 [소스코드] from itertools import combinations, permutations n = int(input()) m = [] for i in range(n): m.append(i+1) per = permutations(m, n) for p in per: print(*p)