#include
using namespace std;
class Solution{
public:
int Callatz(int n)
{
int rtn=0;
while(n != 1)
{
if(n%2 == 0)
{
n /= 2;
++rtn;
}
else
{
n = (3*n+1)/2;
++rtn;
}
}
return rtn;
}
};
int main()
{
Solution s;
int n;
cin >> n;
cout << s.Callatz(n);
}
297

被折叠的 条评论
为什么被折叠?



