HDU 3782 -Dragon Ball
1 #include<stdio.h> 2 #include<stdlib.h> 3 int main() 4 { 5 int n,count; 6 while(scanf("%d",&n)&&n!=0) 7 { 8 count=0; 9 while(n>1) 10 { 11 if(n&1) n=(n*3+1)>>1; 12 else n>>=1; 13 count++; 14 } 15 printf("%d\n",count); 16 } 17 system("pause"); 18 return 0; 19 }