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