# data = []
#
# for i in range(10):
# v = input().split()
# for j in range(len(v)):
# v[j] = int(v[j])
# data.append(v)
#
# x = 1
# y = 1
# data[x][y] = 9
#
# while True:
# # print(x, y)
# if data[x][y+1] == 0:
# data[x][y+1] = 9
# y = y+1
# elif data[x][y+1] == 1:
# if data[x+1][y] == 1:
# break
# elif data[x+1][y] == 2:
# data[x + 1][y] = 9
# break
# elif data[x+1][y] == 0:
# data[x+1][y] = 9
# x = x+1
# elif data[x][y+1] == 2:
# data[x][y+1] = 9
# break
#
# for i in range(10):
# for j in range(10):
# print(data[i][j], end=' ')
# print()
#
#
#
# n=int(input())
# data = []
#
# for i in range(n):
# v = [0] * n
# data.append(v)
# data[0][0]=1
# cnt=1
# num=n*2-1
# c=int(n)
# a=0
# b=n-1
# for i in range(n):
# data[0][i]=i+1
# for i in range(n*2):
# if cnt%4==0:
# for i in range(num//2):
# b=b+1
# c=c+1
# data[a][b]=c
# num=num-1
# if num==1:
# break
# cnt=cnt+1
# elif cnt%4==1:
# for i in range(num//2):
# a=a+1
# c=c+1
# data[a][b]=c
# num=num-1
# if num==1:
# break
# cnt=cnt+1
# elif cnt%4==2:
# for i in range(num//2):
# b=b-1
# c=c+1
# data[a][b]=c
# num=num-1
# if num==1:
# break
# cnt=cnt+1
# elif cnt%4==3:
# for i in range(num//2):
# a=a-1
# c=c+1
# data[a][b]=c
# num=num-1
# if num==1:
# break
# cnt=cnt+1
#
#
# for i in range(n):
# for j in range(n):
# print(data[i][j], end=' ')
# print()
# n = int(input())
# data = []
# for i in range(n+2):
# v = [0] * (n+2)
# data.append(v)
#
# for i in range(n+2):
# for j in range(n+2):
# if i == 0 or j == 0 or i == n+1 or j == n+1:
# data[i][j] = 9
# # boundary
# '''
# [
# [1, 2, 3],
# [4, 5, 6],
# [7, 8, 9],
# [
# [1, 2, 3],
# [4, 5, 6],
# '''
# direct = [[0, 1],
# [1, 0],
# [0, -1],
# [-1, 0]]
# drt = 0
#
# x = 1
# y = 1
# k = 1
# data[x][y] = k
# k += 1
#
# while True:
# dx = direct[drt][0]
# dy = direct[drt][1]
#
# if data[x+dx][y+dy] == 0:
# x += dx
# y += dy
# data[x][y] = k
# k += 1
# else:
# drt += 1
# drt %= 4
# if (k-1) == n*n:
# break
#
# for i in range(1, n+1):
# for j in range(1, n+1):
# print(data[i][j], end=' ')
# print()
# def candy():
# print('This is function area')
#
# def sumation(a, b):
# return a + b
#
# print(sumation(10, 20))
# print(sumation(10.5, 22.3))
# print(sumation('Hello', 'World'))
#
# def var(a, b):
# return a, b, a+b
#
# x, y, z = var(10, 20)
# print(x, y, z)
'''
[]: list
(): tuple
{}: dictionary
'''
# def sum(b):
# c = 0
# while b != 0:
# c = c + b % 10
# b = b // 10
# return c
#
#
# def sum1(a):
# while a//10!=0:
# a=sum(a)
# return a
#
#
#
# a=int(input())
# b=a
# c=0
#
# print(sum1(sum(a)))
def v(x):
s = 0
while True:
s += (x % 10)
x //= 10
if x == 0:
return s
n = int(input())
while n>=10:
n = v(n)
print(n)
top of page
기능을 테스트하려면 라이브 사이트로 이동하세요.
2023-03-12
2023-03-12
댓글 0개
좋아요
댓글(0)
bottom of page