牛浩宇 • 4个月前
include <bits/stdc++.h> using namespace std;
int main() {
list<int>l;
int x, y, z;
cin >> z;
while (z != -1) {
l.push_back(z);
cin >> z;
}
cin >> x >> y;
for (auto s = l.begin(); s != l.end(); ) {
if (*s >= x && *s <= y)
s = l.erase(s);
else
++s;
}
for (auto s = l.begin(); s != l.end(); s++)
cout << *s << " ";
return 0;
}
评论:
请先登录,才能进行评论