SOLUTION INFO
Python · main.py
import sys
def input():
return sys.stdin.readline().rstrip()
def DFS(x,ct):
if x == B:
ans.append(ct)
return
if x * 10 + 1 <= B:
DFS(x * 10 + 1,ct+1)
if x * 2 <= B:
DFS(x*2,ct+1)
A, B = map(int, input().split())
ans = []
DFS(A,1)
if ans:
print(ans[0])
else:
print(-1)
SOLUTION DESCRIPTION
풀이 설명
등록된 풀이 설명이 없습니다.