#include <cstdio>
int main(int argc,char **argv){
unsigned int n;
scanf("%d",&n);
if(n==1){
printf("0\n");
return 0;
}
int count=0;
while(n!=1){
if(n%2==0){
n>>=1;
count++;
}
else{
n=3*n+1;
n>>=1;
count++;
}
}
printf("%d\n",count);
return 0;
}
PAT1001
最新推荐文章于 2022-09-05 18:16:34 发布