문제접근
- while 문 사용하기
문제풀이
내풀이
N = int(input())
compareN = N # compare Number
cnt = 0 # counter
while True:
A = N//10
B = N%10
C = (A+B)%10
N = (B*10)+C
cnt += 1
if N==compareN:
print(cnt)
break
다른사람풀이
N = int(input())
n = -1
t = 0
while n != N:
if n == -1: n = N
n = (n//10 + n%10)%10 + (n%10)*10
t += 1
print(t)
숏코딩
a=n=int(input());c=1
while(a:=a%10*10+a*11//10%10)-n:c+=1
print(c)
'백준 > 기초' 카테고리의 다른 글
[백준][1차원 배열] 2562번 최댓값 (0) | 2022.03.10 |
---|---|
[백준][1차원 배열] 10818번 최소, 최대 (0) | 2022.03.10 |
[백준][while 문] A+B - 4 (0) | 2022.02.28 |
[백준][while문] 10952번 A + B - 5 (0) | 2022.02.28 |
[백준][for 문] 10871번 X보다 작은 수 (0) | 2022.02.25 |