1022 Train Problem I
来源:互联网 发布:淘宝不能与卖家聊天 编辑:程序博客网 时间:2024/06/16 10:02
<span style="font-family: Arial, Helvetica, sans-serif;">#include <cstdlib></span>
#include <iostream>#include <string>#include <cstring>#include<stdio.h>using namespace std;char s1[12];char s2[12];char s3[25][5];char stack[12];int main(){ int n,ptr1,ptr2,ptr3,ptr4; while(scanf("%d",&n)==1) { bool x=true; scanf("%s%s",&s1,&s2); ptr1=ptr2=ptr3=ptr4=0; stack[ptr3]=s1[ptr1]; strcpy(s3[ptr4],"in"); while(true) { if(ptr3<0&&ptr1==n-1) break; if(ptr3>=0&&stack[ptr3]==s2[ptr2]) { strcpy(s3[++ptr4],"out"); ptr2++; ptr3--; } else if(ptr1<n) { stack[++ptr3]=s1[++ptr1]; strcpy(s3[++ptr4],"in"); } else { x=false; break; } } if(!x) printf("No.\n"); else { printf("Yes.\n"); for(int i=0;i<2*n;i++) printf("%s\n",s3[i]); } printf("FINISH\n"); } return 0;}
0 0
- 1022 Train Problem I
- 1022:Train Problem I
- 1022 Train Problem I
- 1022 Train Problem I
- 1022:Train Problem I
- Problem : 1022 ( Train Problem I )
- hdacm-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 Train Problem I
- HDU 1022 Train Problem I
- Hdu 1022 - Train Problem I
- HDOJ 1022 Train Problem I
- HDU-1022:Train Problem I
- hdu 1022 Train Problem I
- hdu 1022 Train Problem I
- 基于ultimus平台的风险管理与内控解决方案
- 使用面向 iOS 的本机插件扩展 PhoneGap
- css 截取字符串长度
- [Leetcode] Reverse Linked List
- 由于这台计算机没有远程桌面客户端访问许可证,远程会话被中断
- 1022 Train Problem I
- 浮点精度问题
- 图像的直方图均衡增强算法
- [数据结构与算法]图的遍历
- 计算机网络系列:搭建FTP服务器之第一篇:安装IIS信息服务
- extern 声明外部变量
- Flash上传出现IO Error #2038的错误解决方法
- Cocos2d-X 学习笔记 8 时间调度
- WordPress 简单优化