| Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 80277 | sh25_huangse | 角谷猜想 | C++ | 通过 | 0 MS | 252 KB | 523 | 2026-01-04 15:11:10 |
#include <iostream> using namespace std; int main() { long long n; // 使用long long防止计算过程中溢出 cin >> n; while (n != 1) { if (n % 2 == 1) { // n是奇数 long long next = n * 3 + 1; cout << n << "*3+1=" << next << endl; n = next; } else { // n是偶数 long long next = n / 2; cout << n << "/2=" << next << endl; n = next; } } cout << "End" << endl; return 0; }