ACboy needs your help again!
ACboy needs your help again!
Time Limit : 1000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other)
Total Submission(s) : 36 Accepted Submission(s) : 29
Font: Times New Roman | Verdana | Georgia
Font Size: ← →
Problem Description
Input
Output
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
Source
#include <stdio.h>
#include <stdlib.h>
#include <string.h> int main()
{
int N,FIFO,FILO,b[],i,j,T,sign[],sum;
scanf("%d",&N);
while(N--)
{
scanf("%d%s",&T,sign);
if(strcmp(sign,"FIFO")==)
{
i=;
j=;
while(T--)
{
scanf("%s",sign);
if(strcmp(sign,"IN")==)
{
scanf("%d",&b[i]);
i++;
}
else if(strcmp(sign,"OUT")==)
{
if(i==j)
{
printf("None\n");
continue;
}
printf("%d\n",b[j]);
j++;
} }
}
else if(strcmp(sign,"FILO")==)
{
i=;
j=;
while(T--)
{
scanf("%s",sign);
if(strcmp(sign,"IN")==)
{
scanf("%d",&b[i]);
i++;
}
else if(strcmp(sign,"OUT")==)
{
if(i==)
{
printf("None\n");
continue;
}
i--;
printf("%d\n",b[i]);
}
}
}
}
return ;
}
ACboy needs your help again!的更多相关文章
- hdu 1702 ACboy needs your help again!
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=1702 ACboy needs your help again! Description ACboy w ...
- (hdu step 8.1.1)ACboy needs your help again!(STL中栈和队列的基本使用)
题目: ACboy needs your help again! Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ...
- hdu 1712 ACboy needs your help
ACboy needs your help Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Ot ...
- hdu 1712 ACboy needs your help 分组背包
转载请注明出处:http://blog.csdn.net/u012860063 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1712 Problem ...
- hdoj 1702 ACboy needs your help again!【数组模拟+STL实现】
ACboy needs your help again! Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ( ...
- HDU 1712 ACboy needs your help 典型的分组背包
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1712 ACboy needs your help Time Limit: 1000/1000 MS ( ...
- ACboy needs your help(HDU 1712 分组背包入门)
ACboy needs your help Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Ot ...
- ACboy needs your help again!--hdu1702
ACboy needs your help again! Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ( ...
- 【泛化物品】【HDU1712】【ACboy needs your help】
ACboy needs your help Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Ot ...
- HDU 1712 ACboy needs your help(包背包)
HDU 1712 ACboy needs your help(包背包) pid=1712">http://acm.hdu.edu.cn/showproblem.php? pid=171 ...
随机推荐
- UML中的类间的关系
1.泛化(Generalization) 指的是子类与父类之间的继承关系,空心三角+实线,箭头指向父类 eg:Father类为Son类的父类 2.依赖(Dependency) 没关系 &g ...
- 虚拟机Q&A
Q1:虚拟机运行一段时间后,各个版本的第一台虚拟机容量变大,增大容量可以接受 原因:不详 解决方法:用备份镜像替换当前镜像 1.1G Jun 24 17:07 win7_sp1_32_0.qcow2 ...
- wakeup_train运行遇到的问题记录
运行前需要更改的地方: 1.matlab安装的路径以及matlab的license文件 2.噪声的路径;background.scp,以及噪声文件 3.run.sh文件中一处f ...
- Apache .htaccess语法之RewriteRule
[说明]定义重写的规则[语法]RewriteRule Pattern rewritePattern [flags] # 开启 rewrite 功能 Options +FollowSymlinks Re ...
- JavaScript 属性操作
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content ...
- 数据库及SQL优化
一.数据库结构的设计 如果不能设计一个合理的数据库模型,不仅会增加客户端和服务器段程序的编程和维护的难度,而且将会影响系统实际运行的性能.所以,在一个系统开始实施之前,完备的数据库模型的设计是必须的. ...
- SQL learning
一.创建和删除数据库 1.创建用户 //创建用户且置密码,在MySQL中行,但在Oracle中行 ----必须在超级管理员身份下操作 create user hncu identified by ' ...
- 第三章 Netty入门应用
3.1 Netty开发环境的搭建 3.1.1 下载Netty的软件包 3.1.2 搭建Netty应用工程 3.2 Netty服务端开发 3.3 Netty客户端开发 3.4 运行和调试 3.4.1 服 ...
- 第一百零四节,JavaScript时间与日期
JavaScript时间与日期 学习要点: 1.Date类型 2.通用的方法 3.格式化方法 4.组件方法 ECMAScript提供了Date类型来处理时间和日期.Date类型内置一系列获取和设置日期 ...
- 《Mastering Opencv ...读书笔记系列》车牌识别(II)
http://blog.csdn.net/jinshengtao/article/details/17954427 <Mastering Opencv ...读书笔记系列>车牌识别(I ...