题解 | #xxx定律#
xxx定律
https://www.nowcoder.com/practice/75c189249d6145cfa33cd53edae6afc8
#include<cstdio> int main() { int n; int count = 0; while (scanf("%d\n", &n) != EOF) { while (true) { if (n == 1) { break; } else { if (n % 2 == 0) { n = n / 2; count++; } else { n = (n * 3 + 1) / 2; count++; } } } printf("%d\n", count); } }