hdu 1022
来源:互联网 发布:sql delete加标记 编辑:程序博客网 时间:2024/05/16 01:15
没什么好说,还是练STL
#include <iostream>#include <stdio.h>#include <vector>#include <stack>#include <algorithm>using namespace std;int main(){ // freopen("in.txt","r",stdin); string train; string trainOrder; vector<string> answer; int trainIndex; int trainOrderIndex; int numOfTrain; stack<char> trainStack; while( cin >> numOfTrain >> train >> trainOrder) { trainIndex = 0; trainOrderIndex = 0; while(!trainStack.empty()) trainStack.pop(); answer.clear(); while(trainOrderIndex < trainOrder.length()) { if(trainStack.empty() || trainOrder[trainOrderIndex] != trainStack.top()) { answer.push_back("in"); trainStack.push(train[trainIndex]); trainIndex++; if(trainIndex > train.length()) break; } else { answer.push_back("out"); trainStack.pop(); trainOrderIndex++; } } if( trainOrderIndex != trainOrder.length()) { printf("No.\n"); printf("FINISH\n"); } else { printf("Yes.\n"); for(int i=0 ;i<answer.size() ;i++) cout << answer[i] << endl; printf("FINISH\n"); } } return 0;}
- hdu 1022
- HDU 1022
- hdu 1022
- HDU 1022
- hdu 1022
- hdu 1022
- hdu 1022
- hdu 1022
- hdu 1022
- hdu 1022
- hdu 1022
- 【HDU】1022
- hdu 1022
- HDU 1022
- hdu 1022
- hdu 1022
- hdu 1022
- HDU 1022
- ,函数调用问题
- android 2.3 电量管理
- Android自动化测试初探: 模拟键盘鼠标事件(Socket+Instrumentation实现)
- pku 2823 双端队列
- C语言面试题大汇总之华为面试题
- hdu 1022
- android 2.3 wifi (一)
- 第一章, 介绍:挖掘twitter的数据
- android 2.3 wifi (二)
- android 2.3 ethernet
- Erlang vs Java memory architecture
- hdu 1048
- 西游记,菩提老祖是谁
- u-boot启动之第2阶段浅析