Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 |
Tags
- MYSQL
- 가상메모리 관리
- level2
- 브루트포스
- 수학
- N과M
- level1
- dfs
- level3
- 스택
- dict
- 백준
- 딕셔너리
- BOJ
- 프로그래머스
- level0
- 파이썬
- BFS
- 코딩테스트
- DP
- python
- 다익스트라
- 재귀
- 다이나믹 프로그래밍
- 그리디
- 가상메모리
- programmers
- 운영체제
- 힙
- 구현
Archives
- Today
- Total
목록10974 (1)
동캄의 코딩도장
백준 10974 [모든 순열] 파이썬
https://www.acmicpc.net/problem/10974 10974번: 모든 순열 N이 주어졌을 때, 1부터 N까지의 수로 이루어진 순열을 사전순으로 출력하는 프로그램을 작성하시오. www.acmicpc.net #10974 n=int(input()) s=[] def dfs(): if len(s)==n: print(' '.join(map(str,s))) return for i in range(1,n+1): if i in s: continue s.append(i) dfs() s.pop() dfs() 1부터 n까지 dfs문을 돌려서 순열을 출력하였다. itertools.permutations() 라는 라이브러리 함수를 사용하면 더욱 쉽게 풀 수 있을거같다.
코테/BOJ
2021. 12. 2. 01:08