1 条题解

  • 1
    @ 2026-8-18 15:47:15

    #include<bits/stdc++.h> using namespace std;

    int main() {

    int n,a[10000],s=1; cin>>n; a[0]=n; while(1) { if(n1) { break; } if(n%21) { n=n*3+1; a[s]=n; s++; } else { n=n/2; a[s]=n; s++; }

    } for(int i=s-1;i>=0;i--) { cout<<a[i]<<" "; }

    return 0;
    

    }

    • 1

    信息

    ID
    9813
    时间
    1000ms
    内存
    125MiB
    难度
    1
    标签
    (无)
    递交数
    122
    已通过
    22
    上传者