车厢的货物

This commit is contained in:
2025-08-04 17:13:06 +08:00
parent d5aba6e9f9
commit fa2e0c39c7

View File

@@ -1,22 +1,15 @@
#include "iostream"
using namespace std;
int n;
int a[105], n;
int main() {
cin >> n;
if (n != 1) {
while (n > 1) {
if (n % 2 == 0) {
n = n / 2;
} else {
n = n * 3 + 1;
}
cout << n << " ";
}
cout << endl << "END";
} else {
cout << "END";
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
for (int i = 1; i <= n; i++) {
cout << a[i];
}
return 0;
}