B001 代码 #include<cstdio> int main(){ int count,input=0;//记录次数 scanf("%d",&input); //确定数据范围 if (input>1000 || input<1) { return 1; } while (input!=1) { if (input%2==0) input = input/2; else input = (3*input+1)/2; count++; } printf("%d\n",count); }