4 条题解

  • 0
    @ 2026-6-9 22:27:02
    #include<bits/stdc++.h> 
    using namespace std;
     int main(){
        long long n;
        cin >> n;
        while (n != 1) {
            if (n % 2 == 1) {
                cout << n << "*3+1=" << n * 3 + 1 << endl;
                n = n * 3 + 1;
            } else {
                cout << n << "/2=" << n / 2 << endl;
                n = n / 2;
            }
        }
        cout << "End" << endl;
            return 0;
             }
    
    

    信息

    ID
    30965
    时间
    1000ms
    内存
    256MiB
    难度
    4
    标签
    (无)
    递交数
    46
    已通过
    21
    上传者