文章
28
粉丝
226
获赞
53
访问
143.8k
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool cmp(int a,int b){
if(a%2 == b%2){
return a < b;
}else{
return a%2 == 1;
}
}
int main()
{
int n;
cin >> n;
vector<int> num(n);
for(int i = 0;i < n;i++){
int tmp;
cin >> tmp;
num[i] = tmp;
}
sort(num.begin(), num.end(),cmp);
for(int i = 0;i < n;i++){
cout << num[i] << " ";
}
cout << endl;
return 0;
}
登录后发布评论
暂无评论,来抢沙发