hdoj 1022 Train Problem I
#include<stdio.h>
int main()
{
int n,i,j,k;
char in[],out[];
int flag[];
while(scanf("%d %s %s",&n,in,out)!=EOF)
{
char stack[];//stack维持着正常的进出栈
int top=-;//栈顶
i=j=k=;
while(j<n+&&i<n)
{
if(top!=-1&&stack[top]==out[i])
{
top--;
flag[k]=;
k++;
i++;
}
else
{
top++;
flag[k]=;
k++;
stack[top]=in[j];
j++;
}
}
if(k!=*n)
printf("No.\n");
else
{
printf("Yes.\n");
for(i=; i<n*; i++)
{
if(flag[i])
printf("in\n");
else
printf("out\n");
}
}
printf("FINISH\n"); }
return ;
}
hdoj 1022 Train Problem I的更多相关文章
- HDOJ 1022 Train Problem
两个数组存进出顺序,如果不同进栈,相同出栈.
- Problem : 1022 ( Train Problem I )
做题思路必须很清晰啊....可以用数组存储in或out来着,第一次C++用string啊,效果还行 Problem : 1022 ( Train Problem I ) Judge Status : ...
- sicily 1022. Train Problem
本题主要是出栈入栈顺序的问题 Home Problems My Status Standing <-> 1022. Train Problem Total: 2 ...
- HDU 1022 Train Problem I(栈的操作规则)
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1022 Train Problem I Time Limit: 2000/1000 MS (Java/Ot ...
- HDU 1022 Train Problem I
A - Train Problem I Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u ...
- hdu 1022 Train Problem I【模拟出入栈】
Train Problem I Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)T ...
- Hdu 1022 Train Problem I 栈
Train Problem I Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- HDU 1022.Train Problem I【栈的应用】【8月19】
Train Problem I Problem Description As the new term comes, the Ignatius Train Station is very busy n ...
- HDU - 1022 Train Problem I STL 压栈
Train Problem I Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
随机推荐
- Windows 10通过本地镜像离线安装.NET 3.5
在Windows10中,当我们安装某些软件的时候会提示"你的电脑上的应用需要使用以下Windows功能:.NET Framework 3.5(包括.NET 2.0和3.0)",由于 ...
- 交易B(队列)
临近考试,又把之前的上机的题目看了一遍,自己又尝试着敲代码,发现好多之前的代码现在看来都被自己复杂化了许多,于是把现在重写的代码再贴出来. 之前的题目和代码戳这里 #include<queue& ...
- Dapper关联查询
1.一对一: using (IDbConnection connecton = new MySqlConnection(ConfigurationManager.ConnectionStrings[& ...
- sql模糊匹配中%、_的处理
防sql注入之模糊匹配中%._处理: StringBuilder sbSql = new StringBuilder(); sbSql.Append(@"SELECT * from tabl ...
- java 中 Math.rint()
Math.rint() **形参是 double System.out.println(Math.rint(2.5)); 返回 2.0 System.out.println(Math.rint(2.5 ...
- Spring Framework 笔记(一):IoC
一:Spring中重要的概念 1. 容器( container ) : spring容器( ApplicationContext )的工作原则是创建容器中的组件( instance ),处理组件之间的 ...
- Linux字符串截取和处理命令 cut、printf、awk、sed、sort、wc
1. cut [选项] 文件名 -f 列号 #提取第几列(分隔符默认为\t) -d 分隔符 #指定分隔符 例如:cut -f 2 a.txt #截取文件a.txt内容的第二列(列号从1开始) cu ...
- 持续集成工具Jenkins学习总结
概述 持续集成(Continuous Integration,简称CI)是一种软件开发实践,团队开发人员每次都通过自动化的构建(编译.发布.自动化测试)来验证,从而尽早的发现集成错误.持续集成最大的优 ...
- 织梦建站:视频弹出播放JS+CSS
需要 jquery.js 文件,JS代码一定要放在HTM下面,否则没效果罗! CSS代码: 1.fdspbf{ width:650px; height:550px; position:fixed; l ...
- android应用中增加权限判断
android6.0系统允许用户管理应用权限,可以关闭/打开权限. 所以需要在APP中增加权限判断,以免用户关闭相应权限后,APP运行异常. 以MMS为例,在系统设置——应用——MMS——权限——&g ...