cses/permutations.cpp

31 lines
368 B
C++

#include <iostream>
#include <string>
int
main(void)
{
long n;
long x;
std::cin >> n;
std::string solution = "";
if (n == 2 || n == 3)
{
std::cout << "NO SOLUTION";
return 0;
}
for (x = 2; x <= n; x += 2)
{
solution += std::to_string(x) + " ";
}
for (x = 1; x <= n; x += 2)
{
solution += std::to_string(x) + " ";
}
std::cout << solution;
}