본문 바로가기

DolphinDash

검색하기
DolphinDash
프로필사진 DolphinDash

  • 분류 전체보기 (14)
    • PS (8)
      • Logic (0)
      • Solve (8)
    • 대외활동 (2)
      • 해커톤 (1)
      • 멋쟁이사자처럼 (1)
    • 개발Log (4)
    • error (0)
    • 개념을 명확히 (0)
    • 인공지능 (0)
      • 딥러닝 (0)
Guestbook
Notice
Recent Posts
Recent Comments
Link
«   2025/05   »
일 월 화 수 목 금 토
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
  • Django
  • 16953
  • ncp배포
  • Charfield
  • 경상국립대학교
  • python
  • NaverCloudPlatform
  • lgh
  • ncloud서버
  • epsp
  • PS
  • 백준 7576
  • 문제풀이
  • 9735번
  • json
  • 백준 7576번
  • 다리 놓기
  • 백준 토마토
  • linc3.0
  • 고속거듭제곱알고리즘
  • 백준
  • 5397
  • 요세푸스 문제
  • 백준 다리놓기
  • max_length
  • 백준 1158번
  • 1010번: 다리 놓기 (Python)
  • 그래프 탐색
  • 7576번
  • 백준 1158
more
Archives
Today
Total
관리 메뉴
  • 글쓰기
  • 방명록
  • RSS
  • 관리

목록DP (1)

DolphinDash

백준 16953번: A → B (Python)

간단한 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
이전 Prev 1 Next 다음

Blog is powered by kakao / Designed by Tistory

티스토리툴바