···stack:
stack sta;
sta.push(2);
sta.top();
sta.pop();
sta.size();//读取栈的大小 返回类型是Int int size=sta.size();
sta.empty();//为空的时候返回true,不为空返回的是false
···queue:
queue q;
q.push(2);
q.front();//读取队列头
q.pop();
sta.size();//读取栈的大小 返回类型是Int int size=sta.size();
sta.empty();//为空的时候返回true,不为空返回的是false
#include <iostream>
#include <stack>
#include <cstdio>
using namespace std;
int n,m,s;
stack<char> st;
char f[110][1100];
int pos[110];
int main()
{
cin>>n>>m>>s;
for(int i=1;i<=n;++i){
scanf("%s",f[i]+1);
pos[i]=1;
}
int t;
while(1){
cin>>t;
if(t==-1)
break;
if(t==0 && st.empty())
continue;
if(pos[t]==m+1)
continue;
if(t==0){
cout<<st.top();
st.pop();
}else{
if(st.size()==s){
cout<<st.top();
st.pop();
}
st.push(f[t][pos[t]]);
pos[t]++;
}
}
return 0;
}