【Basic Level】
*1001 卡拉兹(Callatz)猜想
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int n, c = 0;
cin >> n;
while (n != 1) //n变化后不能使结果跳出判断 (error : &&n<1000)
{
/* code */
if (n % 2 == 0)
{
n >>= 1;
}
else
{
n += (n + 1) /2;
}
//cout << n << endl;
c++;
}
cout << c << endl;
//system("pause");
return 0;
}