Created
July 20, 2020 10:22
-
-
Save vipul43/3cc55d0218b18579205bb2f3201d307f to your computer and use it in GitHub Desktop.
cses day1 problems solutions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <fstream> | |
#include <string> | |
#include <vector> | |
#include <algorithm> | |
using namespace std; | |
typedef long long ll; | |
void solution(){ | |
int n; | |
cin >> n; | |
if(n==1){ | |
cout << 1 << endl; | |
} else if(n<=3){ | |
cout << "NO SOLUTION" << endl; | |
} else{ | |
for(int i=0; i<n; i++){ | |
if((i+1)%2==0){ | |
cout << i+1 << " "; | |
} | |
} | |
for(int i=0; i<n; i++){ | |
if((i+1)%2==1){ | |
cout << i+1 << " "; | |
} | |
} | |
cout << "\n"; | |
} | |
} | |
int main() { | |
int T=1; | |
// cin >> T; | |
for(int t=0; t<T; t++) { | |
solution(); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment