题解
2024-12-09 07:17:05
发布于:浙江
35阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
int a[35],n,b[35], c[35], x = 1, y = 1;
int main(){
cin >> n;
for(int i = 1; i <= n; i++){
cin >> a[i];
if(a[i] % 2 == 1){
b[x] = a[i];
x++;
}
else{
c[y] = a[i];
y++;
}
}
for(int i = 1; i < x; i++){
cout << " " << b[i];
}
cout << endl;
for(int i = 1; i < y; i++){
cout << " " << c[i];
}
}
全部评论 1
冲刺全站第一!!!
2024-12-09 来自 浙江
0
有帮助,赞一个