文章
28
粉丝
226
获赞
53
访问
144.5k
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool cmp(int a, int b){
return a > b;
}
int main()
{
vector<int> a(10);
while(cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4] >> a[5] >> a[6] >> a[7] >> a[8] >> a[9]){
int i = 0;
vector<int> s1;
vector<int> s2;
for(int i = 0;i < 10;i++){
if(a[i]%2 == 0){
s1.emplace_back(a[i]);
}else{
s2.emplace_back(a[i]);
}
}
sort(s1.begin(), s1.end());
sort(s2.begin(), s2.end(), cmp);
for(auto it = s2.begin();it != s2.end();it++){
cout << *it << " ";
}
for(auto it = s1.begin();it != s1.end();it++){
cout << *it << " ";
}
cout << endl;
}
...
登录后发布评论
暂无评论,来抢沙发