No.1168 Digit Sum Sequence
問題文最終更新日: 2020-12-04 09:44:16
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
yukicoder contest 261
(順位表)
の他の問題:
Problem Statement
You are given a positive integer $N$. Define the sequence $(a_i)_{i \geq 1}$ as follows:
- $a_1 = N,$
- $a_{i+1} = (a_i$'s sum of digits in decimal notation$) \quad$ $(i \geq 1).$
Find the value of $a_{100}$.
Input
The input is given in the following format:
$N$
- $N$ is an integer
- $1 \leq N \leq 10^9$
Output
Output the value of $a_{100}$. Print a newline at the end.
Sample
Sample 1
Input
753
Output
6
The terms of $(a_i)_{i \geq 1}$ are as follows:
- $a_1 = 753$
- $a_2 = 7 + 5 + 3 = 15$
- $a_3 = 1 + 5 = 6$
- $a_4 = 6$
- $\ \vdots$
- $a_{100} = 6$
Sample 2
Input
123456789
Output
9
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
opt