答案

。。。。。。。  •  9个月前


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;

}


评论:

请先登录,才能进行评论