P1155双栈排序的测试点#11卡了 但是数据一下,自己写了个程序测试
#include<iostream>
#include<stack>
using namespace std;
const int N=1e5+5;
int n, a[N];char ch;
int t;
stack<int>stk1, stk2;
int main() {
freopen("P1155_11.in", "r", stdin);
cin>>n;
for(int i=1; i<=n; i++) {
scanf("%d", a+i);
}
while(cin>>ch) {
switch(ch) {
case 'a':
stk1.push(a[++t]);
break;
case 'b':
if(!stk1.empty()) {
printf("%d ", stk1.top());
stk1.pop();
}
break;
case 'c':
stk2.push(a[++t]);
break;
case 'd':
if(!stk2.empty()) {
printf("%d ", stk1.top());
stk1.pop();
}
break;
}
}
return 0;
}
一输,好了,神奇的事情发生了
求助,是我程序有问题
还是那个点有问题