hduoj Train Problem I-1022
2016-05-02 17:34
363 查看
细节!!!!!!!!!!!!!!!!!!
#include<stdio.h>#include<stack>#include<stdlib.h>#include<string.h>using namespace std;stack<char> s1;int main(){int n;char str1[1000],str2[1000],falg[1000];while(~scanf("%d %s %s",&n,str1,str2)){memset(falg,-1,sizeof(falg[0]));while(s1.empty()==false){s1.pop();}int j=0,num=0;for(int i=0;i<strlen(str1);i++){s1.push(str1[i]);falg[num]=1;num++;//printf("IN\n");if(s1.top()==str2[j]){while(!s1.empty()&&s1.top()==str2[j]){s1.pop();//printf("Out\n");j++;falg[num]=0;num++;}}}/*while(!s1.empty()){printf("%c ",s1.top());s1.pop();}*/if(j==n){printf("Yes.\n");for(int i=0;i<num;i++){if(falg[i]==1) printf("in\n");else printf("out\n");}}else{printf("No.\n");}printf("FINISH\n");}return 0;}
相关文章推荐
- POJ 1273 Drainage Ditches
- Matrix Chain Multiplication, UVa442
- Uva 514 Rails(栈应用)
- HDU 1789 Doing Homework again
- what's the cygwin and how cai i install this software
- 70. Climbing Stairs
- 服务器TIME_WAIT和CLOSE_WAIT详解和解决办法
- 70. Climbing Stairs
- container_of 宏、offsetof 宏 分析
- Flex AIR ANT 脚本编译
- CodeForces 667A Pouring Rain
- CodeForces 667A Pouring Rain
- hdu2925 Musical Chairs && poj3517 And Then There Was One(约瑟夫环)
- Raid 级别
- Hibernate运行报错Unknown entity: domain.UserBean
- HDU 3394 Railway 点双连通分量 + 桥
- Rails,ACM/ICPC CERC 1997,UVa514
- Insufficient memory<failed to allocate 232852> in cv::OutOfMemoryError
- LeetCode 217. Contains Duplicate
- codeforces 667A A. Pouring Rain(水题)