Skip to content

Commit

Permalink
알고리즘
Browse files Browse the repository at this point in the history
  • Loading branch information
sunyeongchoi committed Mar 2, 2021
1 parent 6f312c0 commit dab6a4d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions argorithm/1463.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import sys
input = sys.stdin.readline

N = int(input())

result = [0 for _ in range(N+1)]
result[1]=0
for i in range(2, N+1):
result[i] = result[i-1]+1
if i%2==0:
result[i] = min(result[i//2]+1, result[i])
if i%3==0:
result[i] = min(result[i//3]+1, result[i])

print(result[N])
Empty file added argorithm/7662.py
Empty file.

0 comments on commit dab6a4d

Please sign in to comment.