日常氵题解
参考文献
#include <bits/stdc++.h>
using namespace std;
int a[100000000];
int main () {
int n, T = 1;
cin >> n;
while (n != 1) {
a[T] = n;
if (n % 2 == 1)
n = n * 3 + 1;
else
n /= 2;
T ++;
}
a[T] = 1;
for (int i = T; i >= 1; i --)
cout << a[i] << " ";
cout << endl;
return 0;
}