Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
141789 张泽辰 行编辑程序 C++ 通过 100 0 MS 252 KB 550 2024-04-06 11:09:25

Tests(14/14):


#include<bits/stdc++.h> using namespace std; int head=0,head1=0; char a[256]; char ch; void push(){ a[head++]=ch; } void pop1(){ head--; } void pop2(){ head=0; } bool empty(){ return head==0; } int main(){ //freopen("editor.in","r",stdin); //freopen("editor.out","w",stdout); while(cin>>ch){ if(ch!='#'&&ch!='@'){ push(); } else if(ch=='#'){ if(!empty()){ pop1(); } } else if(ch=='@'){ if(!empty()){ pop2(); } } } while(!empty()){ cout<<a[head1++]; head--; } }


测评信息: