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 |
Tags
- C++
- Operating System
- error
- 백준
- react
- 코드업
- 스프링
- Spring
- react-redux
- 일상
- 알고리즘
- 공부
- CPU 스케줄링
- js to ts
- OS
- 분할메모리할당
- 자료구조
- web
- 협업
- codeup
- 기초100제
- Redux
- 파이썬
- 리덕스장바구니
- 토이프로젝트
- 타입스크립트
- 정렬
- memory
- Java
- 프로그래머스
Archives
- Today
- Total
목록15650 (1)
감자튀김 공장🍟
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/ozvyG/btrUTYsmK0U/7ou0X5jokLdHitb2xrQMbk/img.png)
✔ 문제 ✔ 풀이 import sys input = sys.stdin.readline n, m = map(int, input().split()) res = [] def dfs(x): if len(res) == m: print(' '.join(map(str, res))) return for i in range(x, n+1): if i not in res: res.append(i) dfs(i + 1) res.pop() dfs(1) ✔ 설명 재귀함수를 이용해서 풀 수 있다. for문에서 (시작, n+1)까지를 범위로 잡아 dfs를 돌면 된다. ex) dfs(1) > res[1] > dfs(2) > res[1, 2] > dfs(3) > len(res) == 2 이므로 print, return > pop() > ..
Algorithm/BOJ
2022. 12. 28. 23:09