forked from kothariji/competitive-programming
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPermutations.cpp
52 lines (44 loc) · 814 Bytes
/
Permutations.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
50
51
52
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
#define mod 10000000007
#define all(x) (x).begin(), (x).end()
typedef long long ll;
void subMain(){
ll n;
cin >> n;
if(n==1){
cout << 1 << "\n";
}
else if(n==2){
cout << "NO SOLUTION" << "\n";
}
else if(n==3){
cout << "NO SOLUTION" << "\n";
}
else{
for(int i= 1; i <= n; i++){
if(i%2==0)
{
cout << i << " ";
}
}
for(int i =1; i <= n; i++){
if(i%2==1)
{
cout << i << " ";
}
}
}
}
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
/*ll t;
cin >> t;
while(t--){
subMain();
}*/
subMain();
return 0;
}