Lee • 4个月前
using namespace std; stacka; stackb; stackd; stackz;
int main() {
int n;
cin >> n;
int v = n;
for (int i = n; i > 0; i--) {
a.push(i);
}
while (n != 0) {
int i, c;
cin >> i >> c;
if (i == 1) {
for (int u = 1; u <= c; u++) {
int y = a.top();
a.pop();
b.push(y);
}
}
if (i == 2) {
for (int u = 1; u <= c; u++) {
int y = b.top();
b.pop();
d.push(y);
}
n -= c;
}
}
for (int i = 0; i < v; i++) {
cout << d.top() << endl;
d.pop();
}
return 0;
}
评论:
请先登录,才能进行评论