100分没过?
查看原帖
100分没过?
1421469
him_out楼主2024/9/10 20:22

就很神奇,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;
}
2024/9/10 20:22
加载中...