diff options
| author | omagdy7 <omar.professional8777@gmail.com> | 2022-11-02 11:50:58 +0200 |
|---|---|---|
| committer | omagdy7 <omar.professional8777@gmail.com> | 2022-11-02 11:50:58 +0200 |
| commit | 8ad882a1deea1ae012c6acf8810e3de9babca9f4 (patch) | |
| tree | b063177175302e0e9daf6eccb5c9ff27c4d801f2 /cses/Permutations/main.cpp | |
| parent | ed30499f7213c756c75527673dd9dbcc1bf059b5 (diff) | |
| download | competitive-programming-8ad882a1deea1ae012c6acf8810e3de9babca9f4.tar.xz competitive-programming-8ad882a1deea1ae012c6acf8810e3de9babca9f4.zip | |
solved 3 problems from cses
Diffstat (limited to 'cses/Permutations/main.cpp')
| -rw-r--r-- | cses/Permutations/main.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/cses/Permutations/main.cpp b/cses/Permutations/main.cpp new file mode 100644 index 0000000..2f55cc4 --- /dev/null +++ b/cses/Permutations/main.cpp @@ -0,0 +1,20 @@ +#include<bits/stdc++.h> + +using namespace std; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int n; + cin >> n; + if (n >= 4 || n == 1) { + for(int i = 2; i <= n; i+=2) { + cout << i << " "; + } + for(int i = 1; i <= n; i+=2) { + cout << i << " "; + } + } else { + cout << "NO SOLUTION" << "\n"; + } +} |
