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
- 7576번
- 1010번: 다리 놓기 (Python)
- 백준 7576
- 백준 7576번
- python
- 백준 토마토
- 문제풀이
- lgh
- 다리 놓기
- 5397
- 백준
- epsp
- 9735번
- PS
- linc3.0
- 백준 다리놓기
- max_length
- 백준 1158
- 16953
- 고속거듭제곱알고리즘
- 요세푸스 문제
- ncloud서버
- ncp배포
- json
- 경상국립대학교
- Django
- Charfield
- 백준 1158번
- 그래프 탐색
- NaverCloudPlatform
Archives
- Today
- Total
목록16953 (1)
DolphinDash

간단한 dp문제인 줄 알고 덤볐다가 조금 오래걸렸다. 처음엔 def dp(que, target, tries): nq = [] if que[0] > target: return -1 for value in que: if value * 2 == target or value * 10 + 1 == target: return tries+1 else: nq.append(value*2) nq.append(value*10 + 1) return dp(nq, target, tries+1) a, b = map(int, input().split()) print(dp([a], b, 1)) 재귀 함수를 만들어서 돌렸더니 메모리 초과가 났다. 일단 tries 횟수가 높아지면 높아질수록 필요 메모리양이 늘어나고 que[-1]의 메모리..
PS/Solve
2023. 5. 19. 23:30