Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
89352 bnu_fanmeijie 角谷猜想 C++ 解答错误 0 MS 244 KB 532 2026-06-02 15:39:34

Tests(0/1):


#include <iostream> using namespace std; int main() { int n; cin >> n; while (n != 1) { if (n % 2 == 0) { // 偶数:除以2 cout << n << "/2=" << n / 2 << endl; n = n / 2; // 更新n为新值 } else { // 奇数:乘3加1 cout << n << "*3+1=" << n * 3 + 1 << endl; n = n * 3 + 1; // 更新n为新值 } } cout << "end" << endl; // 注意:小写 end! return 0; }


测评信息: