小白成长记之PTA乙级题 1001
PTA乙级题 1001. 害死人不偿命的(3n+1)猜想 (15)
#include<stdio.h>
int main()
{
int n,sum;
scanf("%d",&n);
for (sum=0;n!=1;sum++)
{
if (n%2==0)
n/=2;
else
n=(3*n+1)/2;
}
printf("%d",sum);
return 0;
}