1 条题解
-
0
#include <bits/stdc++.h> using namespace std;
int main() { int n, x; cin >> n; int odd[30], even[30]; int cnt1 = 0, cnt2 = 0;
for (int i = 0; i < n; i++) { cin >> x; if (x % 2 != 0) odd[cnt1++] = x; else even[cnt2++] = x; } if (cnt1 > 0) { cout << odd[0]; for (int i = 1; i < cnt1; i++) cout << " " << odd[i]; } cout << endl; if (cnt2 > 0) { cout << even[0]; for (int i = 1; i < cnt2; i++) cout << " " << even[i]; } return 0;}
- 1
信息
- ID
- 28632
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 8
- 标签
- 递交数
- 12
- 已通过
- 11
- 上传者