文章
59
粉丝
0
获赞
298
访问
6.5k
#include <bits/stdc++.h>
using namespace std;
bool cmp(const int &x,const int &y)
{
if(x%2!=0&&y%2==0)
return true;
else if(x%2==0&&y%2!=0)
return false;
return x<y;
}
int main()
{
int n;
vector<int> list;
cin>>n;
for(int i=0;i<n;i++)
{
int x;
cin>>x;
list.push_back(x);
}
sort(list.begin(),list.end(),cmp);
for(int i=0;i<n;++i)
cout<<list[i]<<" ";
cout<<endl;
return 0;
}
登录后发布评论
暂无评论,来抢沙发