diff options
author | Jack Sangdahl <[email protected]> | 2024-12-19 20:32:07 -0700 |
---|---|---|
committer | Jack Sangdahl <[email protected]> | 2024-12-19 20:32:07 -0700 |
commit | 700f2303dfa3307117e8106215c146c419f426cc (patch) | |
tree | d3d767473ba25b197ebb22dd6168dd322a32bb32 /introductory_problems/permutations.cpp | |
parent | c922967b8b2ce6ec78effbc54ae0700c7af1e875 (diff) | |
download | cses-700f2303dfa3307117e8106215c146c419f426cc.tar.gz cses-700f2303dfa3307117e8106215c146c419f426cc.zip |
1070. permutations
Diffstat (limited to 'introductory_problems/permutations.cpp')
-rw-r--r-- | introductory_problems/permutations.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/introductory_problems/permutations.cpp b/introductory_problems/permutations.cpp new file mode 100644 index 0000000..46d8e79 --- /dev/null +++ b/introductory_problems/permutations.cpp @@ -0,0 +1,18 @@ +// 1070. Permutations +#include <bits/stdc++.h> +using namespace std; + +int main() { + static int num; + scanf("%d", &num); + if (num == 1) + printf("1 "); + else if (num <= 3) + printf("NO SOLUTION\n"); + else { + for (int i = 2; i <= num; i += 2) + printf("%d ", i); + for (int i = 1; i <= num; i += 2) + printf("%d ", i); + } +} |