全部评论 4

  • #include<bits/stdc++.h>
    using namespace std;
    int main(){
        int n;
        cin>>n;
        int si=0,st=si;
        string s[10001];
        char z;
        char p=' ';
        for(int i=1;i<=n;i++){
            cin>>z;
            if(z=='v'){
                st++;
                si=st;
                cin>>s[st];
                cout<<s[st]<<endl;
                p='v';
            }
            else if(z=='b'){
                if(st<=1){
                    cout<<"?"<<endl;
                }
                else{
                    st--;
                    cout<<s[st]<<endl;
                }
                p='b';
            }
            else if(z=='f'){
                if(p=='b'&&st<si){
                    st++;
                    cout<<s[st]<<endl;
                    p='f';
                }
                else{
                    cout<<"?"<<endl;
                    p='f';
                }
            }
        }
        return 0;
    }
    

    我这么写只能过一点

    昨天 来自 浙江

    0
  • 过了有罐头

    2天前 来自 浙江

    0
  • 0通过的

    2天前 来自 浙江

    0
  • 这是一个大模拟,仔细看看每个步骤有没有写错的

    4天前 来自 浙江

    0

热门讨论