1001. 害死人不偿命的(3n+1)猜想 (15)

来源:互联网 发布:淘宝考试题和答案2017 编辑:程序博客网 时间:2024/06/04 19:37

#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;}