标签:
#include<stdio.h>
int main()
{
int n,cnt=0;
scanf("%d",&n);
while(n!=1)
{
if(n%2==0)
n/=2;
else
n=(3*n+1)/2;
++cnt;
}
printf("%d\n",cnt);
return 0;
}
PAT:1001. 害死人不偿命的(3n+1)猜想 (15) AC
标签:
原文地址:http://www.cnblogs.com/Evence/p/4291913.html