24 lines
326 B
C++
24 lines
326 B
C++
// Weird Algorithm
|
|
|
|
#include<bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
typedef long long ll;
|
|
|
|
|
|
int main() {
|
|
ll n;
|
|
cin >> n;
|
|
while (n != 1) {
|
|
cout << n << " ";
|
|
if (n & 1) {
|
|
n *= 3;
|
|
n++;
|
|
} else {
|
|
n /= 2;
|
|
}
|
|
}
|
|
cout << n << endl;
|
|
return 0;
|
|
}
|