forked from keshavsingh4522/hacktoberfest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPermitation.cpp
49 lines (46 loc) · 882 Bytes
/
Permitation.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
//author : saurabh nikam
//hackober fest submittion
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define ios ios::sync_with_stdio(false);cin.tie(NULL)
#define endl "\n"
#define ll long long
void solve()
{
ll n;
cin>>n;
if(n==1)
{
cout<<1<<endl;
}else if(n==2||n==3){
cout<<"NO SOLUTION"<<endl;
}else if(n>3){
vector <ll> arr;
for(ll i=2;i<=n;i=i+2)
{
arr.push_back(i);
}
for(ll i=1;i<=n;i=i+2)
{
arr.push_back(i);
}
for(ll i=0;i<arr.size();i++)
{
cout<<arr[i]<<" ";
}
cout<<endl;
}
}
int main()
{
ios;
int tt; //
tt=1;
//cin>>tt;
while(tt--)
{
solve();
}
return 0;
}