hdu 1022 栈
2017-11-15 21:30
176 查看
久违的ac,真是艰难。第一次提交的竟然是直接判断b字符串是否为a的倒序。
#include<iostream> #include<stack> #include<string> using namespace std; int main() { int t; string a,b; while(cin>>t>>a>>b) { stack<char>s; string p; int i=0; t=a.size(); while(t--) { s.push(a[a.size()-t-1]); p+="in\n";//cout<<s.top()<<" "<<b[i]; while(!s.empty()&&s.top()==b[i]) { //cout<<"i"<<i<<endl; s.pop(); p+="out\n"; i++; //cout<<s.size()<<"!!"<<endl; } } if(s.size()==0) cout<<"Yes."<<endl<<p; else cout<<"No."<<endl; cout<<"FINISH"<<endl; } return 0; }
相关文章推荐
- HDU 1022 Train Problem I
- hdu 1022 Train problem I
- HDU-1022-Train Problem I
- hdu-1022-Train Problem I
- [JAVA][HDU 1861][九度 1022][游船出租]
- hdu 1022 Train Problem I 解题报告
- HDU 1022 Train Problem I
- hdu_1022_Train Problem I_(模拟)
- HDU 1022 Train Problem I
- HDU 1022 Train Problem I
- HDU 1022 火车进出站问题
- HDU 1022 Train Problem I 栈
- hdu-1022-train problem I-----nyoj-150
- HDU 1022 Train Problem I(栈)
- hdu 1022
- HDU 1022 Train Problem I
- hdu 1861&&九度1022:游船出租
- Train Problem I hdu 1022 栈的运用
- HDU - 1022
- hdu 1022 Train Problem I(栈的应用。。。)