7.9刚考了,今天又考ρωρ

T1 高级打字机

7.10校内测

7.10校内测

7.10校内测

这里undo可以撤销undo操作emm可真是神奇

先说一下50pts:直接开数组模拟

#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<stack>
using namespace std;
int read()
{
    char ch=getchar();
    int x=0;bool f=0;
    while(ch<'0'||ch>'9')
    {
        if(ch=='-')f=1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9')
    {
        x=(x<<3)+(x<<1)+(ch^48);
        ch=getchar();
    }
    return f?-x:x;
}
int n,u;
char zs[100009];
int main()
{
    freopen("type.in","r",stdin);//考试不要忘了
    freopen("type.out","w",stdout);
    n=read();
    for(int i=1;i<=n;i++)
    {
        char cz=getchar();
        while(cz!='T'&&cz!='U'&&cz!='Q')cz=getchar();
        if(cz=='T')
        {
            char ty=getchar();
            while(ty==' '||ty=='\n'||ty=='\n')ty=getchar();
            zs[++u]=ty;
        }
        if(cz=='Q')
        {
            int num=read();
            if(num>u)printf(" \n");
            else printf("%c\n",zs[num]);
        }
        if(cz=='U')
        {
            int num=read();
            u-=num;
        }
    }
}
50pts

相关文章:

  • 2022-01-06
  • 2021-09-13
  • 2021-11-26
  • 2021-08-26
  • 2021-09-04
  • 2021-07-02
  • 2021-06-17
猜你喜欢
  • 2021-08-11
  • 2021-11-16
  • 2021-12-06
  • 2021-08-22
  • 2021-11-23
  • 2021-08-09
  • 2021-05-31
相关资源
相似解决方案