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 ...
随机推荐
- HeartBeat源码安装
只是写了安装流程,具体信息查看互联网; 环境: CentOS6.8 x86_64 min Heartbeat 3.0.6 http://hg.linux-ha.org/heartbeat-STABLE ...
- oracle之nomount、mount、open三种状态
1.先来看下外国网站上的资料怎么说 Nomount – The database instance has been started (processes and memory structures ...
- Java参数传递问题
参考资料:http://blog.sina.com.cn/s/blog_59ca2c2a0100qhjx.html http://blog.csdn.net/a412588063/article/ ...
- eclipse怎么连接到MySQL中的表!!!!!
简介: 用eclipse编写的好的代码,我们怎么才能连接到数据库呢?对于初学者,特别是在连接数据库这块经常会发生一些莫名的错误,一般来说,归根是我们连接数据库这一过程发生错误.那么我们如何来解决呢?那 ...
- “System.BadImageFormatException”类型的未经处理的异常在 PurchaseDevices.Access.dll 中发生 其他信息: 未能加载文件或程序集“System.Data.SQLite, Version=1.0.66.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139”或它的某一个依赖项。试图加载格式不正确
引用sqlite的程序集时,有时会报如下异常: "System.BadImageFormatException"类型的未经处理的异常在 PurchaseDevices.Acces ...
- 奇葩json结构解析--key是数字的json处理
json结构如下: { "ret": "ok", "data": { "57230": { "cat_id&q ...
- android 图片加载优化,避免oom问题产生
1,及时回收bitmap,在activity的onstop()和onDestory()里面调用如下代码进行bitmap的回收: // 先判断是否已经回收 if(bitmap != null & ...
- 常用几种Java Web容器
Web服务器是运行及发布Web应用的容器,只有将开发的Web项目放置到该容器中,才能使网络中的所有用户通过浏览器进行访问.开发Java Web应用所采用的服务器主要是与JSP/Servlet兼容的We ...
- ACdream 1083 人民城管爱人民
拓扑排序,然后从终点开始递推. #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio ...
- 原生态 php连接mysql
<?php$host = 'localhost';$user = 'root';$pass = '';$dbname = 'test';$con = mysql_connect($host,$u ...