文章
16
粉丝
76
获赞
3
访问
10.0k
#include <bits/stdc++.h>
using namespace std;
bool cmp(int a,int b){
if(a%2==1&&b%2==1)
return a>b;
else if(a%2==0&&b%2==0)
return a<b;
else
return (a%2)>(b%2);
}
int main(){
int a[11];
while(cin>>a[0]>>a[1]>>a[2]>>a[3]>>a[4]>>a[5]>>a[6]>>a[7]>>a[8]>>a[9]){
sort(a,a+10,cmp);
for (int i = 0; i < 10; ++i)
cout<<a[i]<<" ";
cout<<endl;
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发