#include<bits/stdc++.h>
using namespace std;
stack<int> s1;
stack<int> s2;
int main(){
int n,m,maxl,p,a,b; //s1进栈数 s2进栈数
cin>>maxl>>n>>m;
while(n--){
cin>>p;
s1.push(p);
}
while(m--){
cin>>p;
s2.push(p);
}
cin>>a>>b;
if(a!=0){
while(a--){
cout<<s1.top()<<' ';
s1.pop();
}
}else cout<<"no";
cout<<endl;
if(b!=0){
while(b--){
cout<<s2.top()<<' ';
s2.pop();
}
}else cout<<"no";
cout<<endl;
if(!s1.empty()){
while(!s1.empty()){
cout<<s1.top()<<' ';
s1.pop();
}
}else cout<<"no";
cout<<endl;
if(!s2.empty()){
while(!s2.empty()){
cout<<s2.top()<<' ';
s2.pop();
}
}else cout<<"no";
return 0;
}
全部回复 共 0 条
还没有人回复。往下写第一条。
发表回复
登录后即可回复本帖,与出题人和同学一起讨论。
登录