//
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,ans;
while( cin>>n )
{
ans=0;
while( n!=1 )
{ // 先 / 在 * 防止溢出
if( n&1 ) n=( n+1 )/2*3-1;
else n>>=1;
ans++;
}
cout<<ans<<endl;
}
return 0;
}
PTA_1001 害死人不偿命的(3n+1)猜想 (15 分)_简单模拟
猜你喜欢
转载自blog.csdn.net/qq_63173957/article/details/124223009
今日推荐
周排行