티스토리 뷰

# 10953 A+B

 

while True:
    input_data = list(map(int,input().split(' ')))
    
    if input_data[0] == 0 and input_data[1] == 0:
        break
    else:
        print(input_data[0] + input_data[1])

# 10951 A+B

 

import sys

while True :
    try :
        a, b = map(int, input().split())
        print(a+b)
    except :
        break

# 1110 더하기 사이클

 

import math

N = int(input())
n = str(N)[:]
cn = 0
while True:
    a = math.floor(N/10)
    b = N%10
    c = (a+b) % 10
    
    N = int(str(b) + str(c))
    cn += 1
    if N == int(n):
        print(cn)
        break
    else :
        continue

 

 

문제 출처

 

https://www.acmicpc.net/step/2

댓글
링크
최근에 올라온 글
Total
Today
Yesterday