Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
83204 fanziyan 角谷猜想 C++ 通过 0 MS 248 KB 598 2026-01-24 22:28:19

Tests(1/1):


#include <iostream> using namespace std; int main() { int n; cin >> n; if (n == 1) { cout << "End" << endl; return 0; } while (n != 1) { int current = n; int nest; if (current % 2 == 1) { nest = current * 3 + 1; cout << current << "*3+1=" << nest << endl; } else { nest = current / 2; cout << current << "/2=" << nest << endl; } n = nest; // 这一行必须放在while循环体内部! } cout << "End" << endl; return 0; }


测评信息: