Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
77986 梁敖铭 角谷猜想 C++ Wrong Answer 0 MS 264 KB 303 2024-06-15 20:54:50

Tests(0/5):


Code:

#include <iostream> int main() { int n; std::cin >> n; int count = 0; while (n != 1) { if (n % 2 == 0) { n /= 2; } else { n = n * 3 + 1; } count++; } std::cout << count << std::endl; return 0; }


Run Info:

------Input------
100
------Answer-----
100/2=50 50/2=25 25*3+1=76 76/2=38 38/2=19 19*3+1=58 58/2=29 29*3+1=88 88/2=44 44/2=22 22/2=11 11*3+1=34 34/2=17 17*3+1=52 52/2=26 26/2=13 13*3+1=40 40/2=20 20/2=10 10/2=5 5*3+1=16 16/2=8 8/2=4 4/2=2 2/2=1 End
------Your output-----
25