HDOJ/HDU 1022 Train Problem I(模拟栈)】的更多相关文章

Problem Description As the new term comes, the Ignatius Train Station is very busy nowadays. A lot of student want to get back to school by train(because the trains in the Ignatius Train Station is the fastest all over the world ^v^). But here comes…
火车进站,模拟一个栈的操作,额外的栈操作,查看能否依照规定顺序出栈. 数据量非常少,故此题目非常easyAC. 直接使用数组模拟就好. #include <stdio.h> const int MAX_N = 10; char inOrder[MAX_N], outOrder[MAX_N], stk[MAX_N]; bool rs[MAX_N<<2]; int n; int main() { while (scanf("%d", &n) != EOF)…
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1022 Train Problem I Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 45375    Accepted Submission(s): 16966 Problem Description As the new term come…
Train Problem I Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 20521    Accepted Submission(s): 7712 Problem Description As the new term comes, the Ignatius Train Station is very busy nowadays…
Train Problem I Problem Description As the new term comes, the Ignatius Train Station is very busy nowadays. A lot of student want to get back to school by train(because the trains in the Ignatius Train Station is the fastest all over the world ^v^).…
传送门 Description As the new term comes, the Ignatius Train Station is very busy nowadays. A lot of student want to get back to school by train(because the trains in the Ignatius Train Station is the fastest all over the world ^v^). But here comes a pr…
#include<iostream> #include<vector> #include<cstring> #include<string> #include<stack> #include<map> using namespace std; ]; /* 栈的应用 若in[i]==out[j]则先进栈后立即出栈,此时只需i++,j++: 若in[i]!=out[j]检查栈首是否为out[j],若是,则出栈,并j++,否则将in[i]入…
题目大意:有n辆火车,按一定的顺序进站(第一个字符串顺序),问是否能按规定的顺序出站(按第二个字符串的顺序出去),如果能输出每辆火车进出站的过程. 题目思路:栈的特点是先进后出,和题意类似,还有有一种情况是:开进来立马有开出去.并用vis[]数组的0,1标记进出站情况. 具体看代码 #include<cstdio> #include<cstring> #include<cmath> #include<queue> #include<algorithm&…
Train Problem I Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 53352    Accepted Submission(s): 20006 Problem Description As the new term comes, the Ignatius Train Station is very busy nowadays…
Train Problem I Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 41471    Accepted Submission(s): 15510 Problem Description As the new term comes, the Ignatius Train Station is very busy nowaday…
Train Problem I Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 51413    Accepted Submission(s): 19341 Problem Description As the new term comes, the Ignatius Train Station is very busy nowaday…
Train Problem I Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 18095    Accepted Submission(s): 6764 Problem Description As the new term comes, the Ignatius Train Station is very busy nowadays.…
Train Problem I 时间限制:3000 ms  |  内存限制:65535 KB 难度:2 描述 As the new term comes, the Ignatius Train Station is very busy nowadays. A lot of student want to get back to school by train(because the trains in the Ignatius Train Station is the fastest all o…
A - Train Problem I Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1022 Description As the new term comes, the Ignatius Train Station is very busy nowadays. A lot of student want to get back to…
Train Problem I Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 30588    Accepted Submission(s): 11561 Problem Description As the new term comes, the Ignatius Train Station is very busy nowadays…
Problem Description As the new term comes, the Ignatius Train Station is very busy nowadays. A lot of student want to get back to school by train(because the trains in the Ignatius Train Station is the fastest all over the world ^v^). But here comes…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1022 又是一道栈的练习,这次也是没有用到STL中的栈来实现.用来保存操作过程的数组(process[])一定要开得足够大(一开始开小了导致wa) #include <iostream> #include <string.h> #include <stdio.h> using namespace std; ; int main() { char o1[maxn], o2[ma…
栈和队列训练题目. #include <stdio.h> #include <string.h> #define MAXNUM 1005 char in[MAXNUM]; char out[MAXNUM]; char stack[MAXNUM]; char order[MAXNUM]; // 1:in, 0:out int main() { int n; int i, j, k, tmp, flg; int top; while (scanf("%d %s %s"…
本题主要是出栈入栈顺序的问题 Home Problems My Status Standing <->           1022. Train Problem     Total: 2206 Accepted: 703                 Time Limit: 1sec    Memory Limit:256MB Description As the new term comes, the Ignatius Train Station is very busy nowaday…
做题思路必须很清晰啊....可以用数组存储in或out来着,第一次C++用string啊,效果还行 Problem : 1022 ( Train Problem I ) Judge Status : Accepted RunId : 10418893 Language : C++ Author : mnmlist Code Render Status : Rendered By HDOJ C++ Code Render Version 0.01 Beta #include<iostream>…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1022 题目大意: 车的进出站问题,先给出N个火车,再按序列一的方式进站,判断能否以序列二的方式出站,若能先输出"Yes.",再输出出站步骤,以FINISH结束,若不能,输出"No.",仍以FINISH结束. 思路: 直接模拟栈,注意细节! #include<iostream> #include<cstdio> #include<cstrin…
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=1212 Train Problem II Description As we all know the Train Problem I, the boss of the Ignatius Train Station want to know if all the trains come in strict-increasing order, how many orders that all the t…
Train Problem I Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 25817    Accepted Submission(s): 9752 Problem Description As the new term comes, the Ignatius Train Station is very busy nowadays.…
Train Problem II Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4358    Accepted Submission(s): 2391 Problem Description As we all know the Train Problem I, the boss of the Ignatius Train Stati…
题目链接 Counting Offspring Time Limit: 15000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1757    Accepted Submission(s): 582 Problem Description You are given a tree, it’s root is p, and the node is numbered fr…
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=1022 Problem Description As the new term comes, the Ignatius Train Station is very busy nowadays. A lot of student want to get back to school by train(because the trains in the Ignatius Train Stati…
#include<stdio.h> int main() { int n,i,j,k; ],]; ]; while(scanf("%d %s %s",&n,in,out)!=EOF) { ];//stack维持着正常的进出栈 ;//栈顶 i=j=k=; &&i<n) { if(top!=-1&&stack[top]==out[i]) { top--; flag[k]=; k++; i++; } else { top++; fla…
两个数组存进出顺序,如果不同进栈,相同出栈.…
Ugly Problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 0    Accepted Submission(s): 0Special Judge Problem Description Everyone hates ugly problems.You are given a positive integer. You mu…
Water problem 题目链接: http://acm.split.hdu.edu.cn/showproblem.php?pid=5867 Description If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3+3+5+4+4=19 letters used in total.If all the numbers from 1 to n (up to…