http://acm.hdu.edu.cn/showproblem.php?pid=3782
#include <stdio.h>
int main()
{
int n,t;
while (scanf("%d",&n)&&n!=0)
{
int ans=0;
while (n!=1)
{
if (n%2==0)
{
n=n/2;
ans++;
}
else
{
n=(3*n+1)/2;
ans++;
}
}
printf("%d\n",ans);
}
return 0;
}