A.cpp 335 B

12345678910111213141516171819
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. typedef long long LL;
  4. int main() {
  5. LL n;
  6. while(cin>>n) {
  7. int tot = 0;
  8. while (n > 1) {
  9. if (n % 2 == 0)
  10. n /= 2;
  11. else
  12. n = 3 * n + 1;
  13. ++tot;
  14. }
  15. cout << tot << endl;
  16. }
  17. return 0;
  18. }