mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
ff9985fa25
3700-3799
21 lines
332 B
C++
21 lines
332 B
C++
#include <iostream>
|
|
using namespace std;
|
|
int main()
|
|
{
|
|
int n;
|
|
while(cin >> n && n)
|
|
{
|
|
int cnt = 0;
|
|
while(n!=1)
|
|
{
|
|
if(n%2)
|
|
n = (3*n+1)/2;
|
|
else
|
|
n = n/2;
|
|
cnt++;
|
|
}
|
|
cout << cnt << endl;
|
|
}
|
|
return 0;
|
|
}
|