#include<stdio.h>
int main(){
int n,count=0;
scanf("%d",&n);
while(n!=1){
if(n%2==1) n=(3*n+1)/2;
else n=n/2;
count++;
}
printf("%d",count);
return 0;
}
1001. 害死人不偿命的(3n+1)猜想 (15)
最新推荐文章于 2017-05-24 11:44:42 发布
#include<stdio.h>
int main(){
int n,count=0;
scanf("%d",&n);
while(n!=1){
if(n%2==1) n=(3*n+1)/2;
else n=n/2;
count++;
}
printf("%d",count);
return 0;
}