Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
89358 bnu_fanmeijie 角谷猜想 C++ 通过 1 MS 252 KB 530 2026-06-02 18:20:05

Tests(1/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; }


测评信息: