114514

Adolf Hitler  •  4个月前


#include <bits/stdc++.h>
using namespace std;

int main() {
	list<int>sd;
	int x, y, z;
	cin >> z;
	while (z != -1) {
		sd.push_back(z);
		cin >> z;
	}
	cin >> x >> y;
	for (auto ss = sd.begin(); ss != sd.end(); ) {
		if (*ss >= x && *ss <= y) {
			ss = sd.erase(ss);
		} else {
			++ss;
		}
	}
	for (auto ss = sd.begin(); ss != sd.end(); ss++) {
		cout << *ss << " ";
	}

	return 0;
}


评论:

请先登录,才能进行评论