약간의 노가다성, 내답
a,b=map(int,input().split())
m=abs(b-a)
k=m%10
if k==1 or k==5:
print(m//10+1)
elif k==9 or k==6 or k==4 or k==2:
print(m//10+2)
elif k==8 or k==7 or k==3:
print(m//10+3)
else:
print(m//10)
def cal10(n,t):
if n<=t:
return n+10
else:
return n-10
def cal5(n,t):
if n<=t:
return n+5
else:
return n-5
def cal1(n,t):
if n<=t:
return n+1
else:
return n-1
now, target =map(int,input().split())
count=0
while True:
if now==target:
break
if abs(target-now)>=10:
now=cal10(now,target)
count +=1
continue
elif abs(target-now)>=5:
new1=cal10(now,target)
new2=cal5(now, target)
if abs(target-new1)<abs(target-new2):
now=new1
else:
now=new2
count+=1
continue
else:
new1=cal5(now,target)
new2=cal1(now, target)
if abs(target-new1)<abs(target-new2):
count+=abs(target-new1)+1
else:
count+=abs(target-new2)+1
break
print(count)
정말 어렵구나