AtCoder Beginner Contest 116
翻译中…
Problem Statement
翻译中…
A sequence $a=\{a_1,a_2,a_3,......\}$ is determined as follows:
翻译中…
- The first term
$s$is given as input. - Let
$f(n)$be the following function:$f(n) = n/2$if$n$is even, and$f(n) = 3n+1$if$n$is odd. $a_i = s$when$i = 1$, and$a_i = f(a_{i-1})$when$i > 1$.
翻译中…
Find the minimum integer $m$ that satisfies the following condition:
翻译中…
- There exists an integer
$n$such that$a_m = a_n (m > n)$.
翻译中…
Constraints
翻译中…
$1 \leq s \leq 100$- All values in input are integers.
- It is guaranteed that all elements in
$a$and the minimum$m$that satisfies the condition are at most$1000000$.
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
s
翻译中…
Output
翻译中…
Print the minimum integer $m$ that satisfies the condition.
翻译中…
样例
Input #1
8
Output #1
5
$a=\{8,4,2,1,4,2,1,4,2,1,......\}$. As $a_5=a_2$, the answer is $5$.
Input #2
7
Output #2
18
$a=\{7,22,11,34,17,52,26,13,40,20,10,5,16,8,4,2,1,4,2,1,......\}$.
Input #3
54
Output #3
114
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。