fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int ile,x,y=0;
  5.  
  6. int main()
  7. {
  8. cin>>ile;
  9.  
  10. for(int i=1; i<=ile; i++)
  11. {
  12. cin>>x;
  13. while(x!=1)
  14. {
  15. if(x%2)
  16. x=x*3+1;
  17. else
  18. x/=2;
  19. y++;
  20. }
  21. cout<<y;
  22. y=0;
  23. }
  24. return 0;
  25. }
Success #stdin #stdout 0s 15240KB
stdin
5
1 
2
8
3
567
stdout
013761