728x90
반응형
문제 출처:https://www.acmicpc.net/problem/1110
풀이:
a = b = int(input())
count =0
while True:
ten = a//10
one = a%10
total = ten + one
count += 1
a =int(str(a%10)+str(total%10))
if(a == b):
break
print(count)
while 문 안에
a =int(str(a%10)+str(total%10))
str 을 해준 이유는 str 로 형 변환후 1 + 2 는 3이 아닌 12 로 나오기때문이다.
반응형
댓글