4 条题解

  • -1
    @ 2026-6-12 20:37:33

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

    int main() { int N; cin >> N; while (N != 1) { if (N % 2 == 0) { cout << N << "/2=" << N / 2 << endl; N /= 2;

    	} else {
    		cout << N << "*3+1=" << N * 3 + 1 << endl;
    
    		N = N * 3 + 1;
    
    	}
    
    }
    cout << "End";
    
    return 0;
    

    }

    信息

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