文章
105
粉丝
69
获赞
117
访问
57.0k
#include<bits/stdc++.h>
using namespace std;
const int N = 15;
int num[N];
int og[N], os[N];
int cnt, cnt1, cnt2;
int main()
{
while(cin >> num[cnt])
{
if(num[cnt] % 2 == 0) og[cnt1 ++] = num[cnt ++];
else os[cnt2 ++] = num[cnt ++];
if(cnt == 10)
{
sort(os, os + cnt2, greater<int>());
sort(og, og + cnt1);
for(int i = 0; i < cnt2; i ++) cout << os[i] << " ";
for(int i = 0; i < cnt1; i ++) cout << og[i] << " ";
cnt = cnt1 = cnt2 = 0;
cout << endl;
}
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发