1001

#include
using namespace std;

int main()
{
    unsigned n = 0;
    cin >> n;
    unsigned char count = 0;
    while (1 != n)
    {
        count += 1;
        if (0 == n % 2)
        {
            n = n / 2;
        }
        else
        {
            n = (3 * n + 1) / 2;
        }
    }

    cout << static_cast(count);

    cin.ignore();
    return 0;
}

你可能感兴趣的:(1001)