就很神奇,100分没过,代码如下。(水的题)
5、6TLE
#include<iostream>
using namespace std;
int main()
{
int a;
cin >> a;
while(a != 1)
{
if(a%2==0)
{
cout << a << "/2=" << a/2 << endl;
a/=2;
}
else
{
cout << a << "*3+1=" << a*3+1 << endl;
a = a*3+1;
}
}
cout << "End";
return 0;
}