백준 1110 (파이썬)

김덕현·2021년 5월 29일
1

BAEKJOON

목록 보기
30/62

1.문제

https://www.acmicpc.net/problem/1110

2.코드

n = int(input())
count = 0
if(n<10):
    n = "0" + str(n)
else:
    n = str(n)
orin = n    
while True:
    count += 1
    k = n     
    total = 0
    for i in range(len(k)):
        total += int(k[i])
    
    k = str(total)
    n = n[-1] + k[-1]
    
    if n == orin:   
        break

print(count)

3.코드해설

profile
BAEKJOON STUDYING

0개의 댓글