标签:
#include <iostream>
using namespace std;
int main()
{
int n;
int i = 0;
cin >> n;
if (n == 1)
{
cout << "0" << endl;
exit(0);
}
else
{
B:if (n % 2 == 0)
{
n = n / 2;
i=i+1;
goto A;
}
else
{
n = 3 * n + 1;
n = n / 2;
i=i+1;
goto A;
}
}
A:if (n == 1)
cout << i << endl;
else goto B;
return 0;
}
标签:
原文地址:http://www.cnblogs.com/code666/p/5869615.html