[ZJ-001] 冰雹猜想/角谷猜想
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
Background
The Collatz Conjecture states that:
For any positive integer :
-
If it's odd, multiply it by and add , i.e.: ;
-
If it's even, divide it by , i.e.: .
By repeating these operations, the number will eventually reach and fall into the loop.
Description
Now, write a program to calculate how many operations are needed for a positive integer to transform into .
Input
A single line containing the positive integer to be processed.
Output
A non-negative integer , representing the number of operations required.
7
16
8
3
Hint
【Data Scale and Convention】
For of the data, .