啊这,我本以为还会很难,但没想到就这:

#include<stdio.h>
int main()
{
    int n = 0;
    int count = 0;
    scanf("%d",&n);
    while(n != 1)
    {
        if(n%2 ==1)
        {
            n=3*n+1;
            count++;
        }
        else
        {
            n=n/2;
            count++;
        }
    }
    printf("%d\n",count);
    return 0;
}