19 lines
328 B
C++
19 lines
328 B
C++
#include<bits/stdc++.h>
|
|
using namespace std;
|
|
int main()
|
|
{
|
|
int count = 0;
|
|
long long n;//定义64位长整型数
|
|
scanf("%lld", &n);//此处"%lld"也可写成"%I64d"
|
|
while(n > 1)
|
|
{
|
|
if(n%2 == 1) n = n * 3 + 1;
|
|
else n /= 2;
|
|
count++;
|
|
}
|
|
printf("%d\n", count);
|
|
return 0;
|
|
}
|
|
|
|
|