forked from abheekd/usaco-practice
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
255 B
18 lines
255 B
#include <iostream>
|
|
using namespace std;
|
|
|
|
int main() {
|
|
long long i;
|
|
cin >> i;
|
|
cout << i << " ";
|
|
|
|
while (i != 1) {
|
|
if (i % 2 == 0) {
|
|
i = i / 2;
|
|
cout << i << " ";
|
|
} else {
|
|
i = i * 3 + 1;
|
|
cout << i << " ";
|
|
}
|
|
}
|
|
}
|
|
|