周屹杨 • 12天前
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int sum = 0; while (n > 1) { if (n % 2 == 0) { n /= 2; } else { n = n * 3 + 1; } sum += 1; } cout << sum; return 0; }
评论: