刘嘉柚 • 3个月前
//没人知道注释里的是快读
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF=0x3f3f3f;
ll giao_gff;
/*inline int read(){
bool flag=false;int x = 0;
char ch=getchar();
while(ch<'0'||ch>'9'){
if(ch=='-') flag=true;
ch=getchar();
}
while(ch>='0'&&ch<='9'){
x=(x<<1)+(x<<3)+ch-'0';
ch=getchar();
}
return flag?-x:x;
}*/
int main(){
cin>>giao_gff;cout<<giao_gff<<" ";
while(giao_gff>1){
if(giao_gff%2==0){giao_gff/=2;cout<<giao_gff<<" ";}
else{giao_gff=giao_gff*3+1;cout<<giao_gff<<" ";}
}
}
Comments: