Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<cstdio>
- #include<list>
- #include<iostream>
- using namespace std;
- int main(){
- int tc;
- int tab[100000];
- for(int i=0; i<100000; i++){
- tab[i]=-1;
- }
- int n=0;
- cin>>tc;
- for(int t=0; t<tc; t++){
- char c=' ';
- while(c!='A' && c!='D' && c!='S'){
- c=getchar();
- }
- if(c=='A'){
- int num;
- cin>>num;
- num=tab[n];
- ++n;
- }
- else if(c=='D') {
- if(tab[n]==-1) // lista pusta
- cout<<"EMPTY"<<endl;
- else {
- int num=tab[0];
- cout<<num<<endl;
- for(int i=0; i<n; i++){
- tab[i]=tab[i+1];
- }
- --n;
- }
- }
- else {
- cout<<n<<endl;
- }
- }
- }
Add Comment
Please, Sign In to add comment