hdu1702栈和队列
来源:互联网 发布:idc数据公司 编辑:程序博客网 时间:2024/06/06 00:49
ACboy needs your help again!
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 7032 Accepted Submission(s): 3642
Problem Description
ACboy was kidnapped!!
he miss his mother very much and is very scare now.You can’t image how dark the room he was put into is, so poor :(.
As a smart ACMer, you want to get ACboy out of the monster’s labyrinth.But when you arrive at the gate of the maze, the monste say :” I have heard that you are very clever, but if can’t solve my problems, you will die with ACboy.”
The problems of the monster is shown on the wall:
Each problem’s first line is a integer N(the number of commands), and a word “FIFO” or “FILO”.(you are very happy because you know “FIFO” stands for “First In First Out”, and “FILO” means “First In Last Out”).
and the following N lines, each line is “IN M” or “OUT”, (M represent a integer).
and the answer of a problem is a passowrd of a door, so if you want to rescue ACboy, answer the problem carefully!
Input
The input contains multiple test cases.
The first line has one integer,represent the number oftest cases.
And the input of each subproblem are described above.
Output
For each command “OUT”, you should output a integer depend on the word is “FIFO” or “FILO”, or a word “None” if you don’t have any integer.
Sample Input
4
4 FIFO
IN 1
IN 2
OUT
OUT
4 FILO
IN 1
IN 2
OUT
OUT
5 FIFO
IN 1
IN 2
OUT
OUT
OUT
5 FILO
IN 1
IN 2
OUT
IN 3
OUT
Sample Output
1
2
2
1
1
2
None
2
3
其实,还挺简单的,主要考查到的是栈和队列的内容,有人把它划分到深搜中,其实大可不必
include
include
include
using namespace std;
int main()
{
int T,n,i,j,m;
char s[10];
scanf(“%d”,&T);
while(T–)
{
scanf(“%d %s”,&n,s);
if(s[2]==’F’)
{
queueque;
for(i=0;i
- hdu1702栈和队列
- hdu1702(栈和队列)
- hdu1702 Java 栈和队列
- hdu1702 队列与栈
- hdu1702 ACboy needs your help again!(栈和队列
- HDU1702--ACboy needs your help again!(栈和队列)
- HDU1702 队列 与 栈 基础题
- HDU1702:ACboy needs your help again!(栈和队列的应用)
- 栈和队列上手题 HDU1702 HDU1022 HDU1237 HDU3328 HDU1873 HDU1509 HDU1870 HDU1387 题意
- 栈和队列上手题 HDU1702 HDU1022 HDU1237 HDU3328 HDU1873 HDU1509 HDU1870 HDU1387 题解
- HDU1702-----队列简单题
- HDU1702 ACboy needs your help again! 队列&&栈的应用
- HDU1702
- HDU_Steps8.1 栈,队列 HDU1702 HDU1022 HDU1237 HDU3228 HDU1873 HDU1509 HDU1870 HDU1387
- STL之栈结构 例题hdu1702
- 栈和队列--队列
- 【栈和队列】队列
- 栈、队列和优先队列
- 关于RaspberryPi 3的CPU
- lvs-dr模式原理详解和可能存在的“假负载均衡”
- SQL 模式的 10 条规则
- Linux 、Android将在汽车舞台上开战
- 内部类
- hdu1702栈和队列
- 斯坦福机器学习网易公开课笔记10
- vue-cli 安装
- VR SelectROI的实现方法(2)
- JS表格组件神器bootstrap table详解(基础版)
- HTML入门
- 庖丁解牛<c++primer>系列三:类型别名和自定义数据结构
- Master棋手完胜人类 但仍属弱人工智能
- pat 甲1127. ZigZagging on a Tree (已知后序及中序建树,并层次往返输出)