巴适哦!真80.。。。
查看原帖
巴适哦!真80.。。。
1413309
makeway楼主2024/10/25 20:03
#include<bits/stdc++.h>
using namespace std;
long long int x,a[10000000],i=1;
int main()
{
    cin>>x;
    if(x==1)cout<<x;
    while(x!=1)
	{
		a[i]=x;
		i++;
		if(x%2==0) x/=2;
		else x=3*n+1;
	}
	a[i]=1;
	for(int j=i;j>=1;j--)
	{
		cout<<a[j]<<" ";
	}
	return 0;
}
2024/10/25 20:03
加载中...