[백준/파이썬] 10974 모든 순열

bye9·2021년 1월 28일
0

알고리즘(코테)

목록 보기
31/130

https://www.acmicpc.net/problem/10974


알고리즘 분류

  • 브루트포스

문제풀이

1부터 n까지의 리스트를 가지고 모든 순열을 만들어준다.

소스코드

from itertools import permutations

n=int(input())
lst=[]

for i in range(1,n+1):
  lst.append(i)

result=list(permutations(lst, n))
for i in result:
  for j in i:
    print(j, end=' ')
  print()

0개의 댓글