B2077求助
  • 板块灌水区
  • 楼主jinzening
  • 当前回复1
  • 已保存回复1
  • 发布时间2024/12/24 12:31
  • 上次更新2024/12/24 19:00:55
查看原帖
B2077求助
1439379
jinzening楼主2024/12/24 12:31
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n;
	cin >> n;
	while(1)
	{
		if(n % 2 == 0)
		{
			cout << n << '/' << 2 << '=';
			n /= 2;
			cout << n << endl;
			if(n == 1)
			{
				cout << "End";
				break;
			}
		}
		else
		{
			cout << n << '*' << 3 << '+' << 1 << '=';
			n = n * 3 + 1;
			cout << n << endl;
			if(n == 1)
			{
				cout << "End";
				break;
			}
		}
	}
    return 0;
}
2024/12/24 12:31
加载中...