forked from fineanmol/Hacktoberfest2024
-
Notifications
You must be signed in to change notification settings - Fork 30
/
cses1.cpp
49 lines (49 loc) · 1023 Bytes
/
cses1.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("fma,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimization ("unroll-loops")
#define ll long long
#define el endl
#define pb push_back
#define mp make_pair
#define rep(i,a,n) for(int i=a;i<n;i++)
#define rop(i,a,n) for(int i=a;i<=n;i++)
#define I insert
#define faster ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) v.begin(),v.end()
#define PI 3.1415926535
#define fi first
#define se second
#define pp pair<int,int>
#define setx(n) fixed<<setprecision(n)
#define MAX (int)1e5+10
using namespace std;
bool ifsort(ll *ar,ll n)
{
ll f=1;
for(ll i=0;i<n-1;i++)
{
if(ar[i]>ar[i+1])
f=0;
}
if(f==0)
return false;
else
return true;
}
int main()
{
ll n; cin>>n;
while(n!=1)
{
cout<<n<<" ";
if(n%2)
{
n=n*3+1;
}
else
n=n/2;
}
cout<<1<<el;
return 0;
}