答案

答案

。。。。。。。 · 发布于 2023-12-17 · 浏览 545 回复 0

include

include

using namespace std;

int main() {

int n;
cin >> n;
stack<int>a;
stack<int>b;
while (n--) {
	int j;
	cin >> j;
	if (j % 2 == 0) {
		b.push(j);
	} else {
		a.push(j);
	}
}
while (!a.empty()) {
	cout << a.top() << "  ";
	a.pop();
}
cout << endl;
while (!b.empty()) {
	cout << b.top() << "  ";
	b.pop();
}
return 0;

}

全部回复 共 0 条

还没有人回复。往下写第一条。

发表回复