1 solutions
-
0
#include<bits/stdc++.h> using namespace std; const int N=1010; int a[N]; bool cmp(int a,int b) { if(a%2!=0&&b%2==0) return 1; if(a%2!=0&&b%2!=0&&a>b) return 1; if(a%2==0&&b%2==0&&a<b) return 1; return 0; } int main() { int n; cin>>n; for(int i=1;i<=n;i++) { cin>>a[i]; } sort(a+1,a+n+1,cmp); for(int i=1;i<=n;i++) { cout<<a[i]<<" "; } return 0; }
- 1
Information
- ID
- 116
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 1
- Tags
- (None)
- # Submissions
- 33
- Accepted
- 19
- Uploaded By