1 条题解

  • 0
    @ 2026-5-31 16:30:10
    #include <bits/stdc++.h>
    using namespace std;
    #define int long long
    
    signed main() {
    	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    	int n;
    	cin >> n;
    	while (1) {
    		if (n == 1) {
    			cout << "End" << '\n';
    			return 0;
    		}
    		if (n % 2) {
    			cout << n << "*3+1=" << n * 3 + 1 << '\n';
    			n = n * 3 + 1;
    		} else {
    			cout << n << "/2=" << n / 2 << '\n';
    			n /= 2;
    		}
    	}
      return 0;
    }
    
    
    • 1

    信息

    ID
    237
    时间
    1000ms
    内存
    256MiB
    难度
    2
    标签
    递交数
    86
    已通过
    52
    上传者