- 龙凤苑中学C班4.30
冰雹猜想
- @ 2024-4-30 17:45:46
#include<bits/stdc++.h> using namespace std; int main(){ long long num=0,n,a[114514]; cin>>n; while(n!=1){ a[num++]=n; if(n%2==0){ n/=2; } else{ n=n*3+1; } } a[num]=1; for(int i=num;i>=0;i--){ cout<<a[i]<<" "; } return 0; }
0 comments
No comments so far...