今天上午学习了《栈》和深度优先搜索DFS
课件如下:………………额………上传不了。
代码如下:
#include
using namespace std;
string str;
char s[1000];
int top,i;
int main(){
freopen("t1.in","r",stdin);
freopen("t1.out","w",stdout);
while(getline(cin,str)){
int l=str.size()-1;
for(i=0;i=0) top--;
}
else{
if(ch=='@') top=0;
else{top++;s[top]=ch;}
}
}
for(i=1;i<=top;i++) cout<<s[i];
cout<<endl;
top=0;
}
return 0;
}
以及演示案例:…………额…………无权上传
听到明天还要模考的时候我已经在祈祷不要再爆零了。