简单模拟B1001

#include<iostream>

using namespace std;

int main()
{
    int n;
    int step = 0;
    cin >> n;
    while(n != 1)
    {
        if(n % 2 == 1)
        {
            n = (3*n+1)/2;
            step++;
        }
        else
        {
            n = n/2;
            step++;
        }
    }
    cout << step <<endl;
    return 0;
}
原文地址:https://www.cnblogs.com/zhangqiling/p/12054725.html