P6206 [USACO06OCT] Another Cow Number Game G
Description
The cows are playing a number game, and Bessie wants you to help her predict the result. At the start of the game, Bessie is given a positive integer $N$. Her score is $0$ at this time.
The cows transform $N$ using the following rules:
- If $N$ is odd, multiply it by $3$ and then add $1$.
- If $N$ is even, divide it by $2$.
Each time the number is transformed, Bessie gains $1$ point. When $N=1$, the game ends. The score at this time is her final score.
Input Format
One line containing one integer $N$.
Output Format
One line containing one integer, which is Bessie’s final score.
Explanation/Hint
**Constraints**
For $100\%$ of the testdata, $1\le N\le 10^6$.
------------
**Sample Explanation**
When the initial value of $N$ is $5$, the game proceeds as follows:
| $N$ | Number after the transformation | Transformation | Total score |
| :----------: | :----------: | :----------: | :----------: |
| $5$ | $16$ | $3\times 5+1$ | $1$ |
| $16$ | $8$ | $16\div 2$ | $2$ |
| $8$ | $4$ | $8\div 2$ | $3$ |
| $4$ | $2$ | $4\div 2$ | $4$ |
| $2$ | $1$ | $2\div 2$ | $5$ |
Bessie’s final score is $5$.
Translated by ChatGPT 5