fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int n;
  4. int main(){
  5. ios::sync_with_stdio(0);
  6. cin.tie(0);
  7. cin >> n;
  8. if(n == 3 || n == 2 ){
  9. cout << "NO SOLUTION";
  10. }
  11. else if(n == 4){
  12. cout << "3 1 4 2";
  13. }
  14. else{
  15. for(int i = n;i > 0; i -=2){
  16. cout << i << " ";
  17. }
  18. for(int i = n - 1;i > 0; i -=2){
  19. cout << i << " ";
  20. }
  21. }
  22. return 0;
  23.  
  24. }
  25.  
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
Standard output is empty