Windows Message Queue--hdu1509
Windows Message Queue
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 4395 Accepted Submission(s): 1745
GET
PUT msg1 10 5
PUT msg2 10 4
GET
GET
GET
这个题的大意是:输入GET就输出输入的数据,如果没数据就输出EMPTY QUEUE!
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<queue>
#define max 60010
using namespace std;
struct as
{
char a[];
int b,c,d;
bool friend operator <(as x,as y)
{
if(x.c!=y.c)
return x.c>y.c;//如果优先级不相等,从小到大排
else
return x.d>y.d;//如果优先级相等,按输入先后顺序排
}
}aa[max];
priority_queue<struct as>q;
char str[];
int main()
{
int i=,j,k,n;
while(scanf("%s",str)!=EOF)
{
getchar();
if(strcmp(str,"PUT")==)
{
scanf("%s",aa[i].a);
scanf("%d %d",&aa[i].b,&aa[i].c);//输入参数和优先级
aa[i].d=i;//记录输入的先后次序,以便aa[i].y相等时比较
q.push(aa[i]);
i++;
}
else if(strcmp(str,"GET")==)
{
if(q.empty())
printf("EMPTY QUEUE!\n");
else
{
struct as er=q.top();
q.pop();
printf("%s %d\n",er.a,er.b);
}
}
}
return ;
}
Windows Message Queue--hdu1509的更多相关文章
- hdu 1509 Windows Message Queue
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=1509 Windows Message Queue Description Message queue ...
- hdoj 1509 Windows Message Queue【优先队列】
Windows Message Queue Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Ot ...
- Windows Message Queue(优先队列)
欢迎参加——BestCoder周年纪念赛(高质量题目+多重奖励) Windows Message Queue Time Limit: 2000/1000 MS (Java/Others) Mem ...
- Windows Message Queue
Windows Message Queue Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Other ...
- zoj 2724 Windows Message Queue
Windows Message Queue Time Limit: 2 Seconds Memory Limit: 65536 KB Message queue is the basic f ...
- hdu 1509 Windows Message Queue (优先队列)
Windows Message QueueTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Oth ...
- hdu1509(Windows Message Queue) 优先队列
点击打开链接 Problem Description Message queue is the basic fundamental of windows system. For each proces ...
- D - Windows Message Queue
来源hdu1509 Message queue is the basic fundamental of windows system. For each process, the system mai ...
- HDU 1509 Windows Message Queue(队列)
题目链接 Problem Description Message queue is the basic fundamental of windows system. For each process, ...
- H - Windows Message Queue
Message queue is the basic fundamental of windows system. For each process, the system maintains a m ...
随机推荐
- PHP PSR-3 日志接口规范 (中文版)
日志接口规范 本文制定了日志类库的通用接口规范. 本规范的主要目的,是为了让日志类库以简单通用的方式,通过接收一个 Psr\Log\LoggerInterface 对象,来记录日志信息. 框架以及CM ...
- information_schema.character_sets 学习
information_schema.character_sets 表用于查看字符集的详细信息 1.character_sets 常用列说明: 1.character_set_name: 字符集名 2 ...
- You and your research
英文版http://www.cs.virginia.edu/~robins/YouAndYourResearch.html 视频版http://www.youtube.com/watch?v=a1zD ...
- 在 .NET Framework 2.0上使用LINQ
附件:System.Linq.dll.7z 此为从System.Core.dll中剥离的Linq,含有System.Linq.Enumerable类所有扩展方法,可以在客户只安装了.Net 2.0的环 ...
- 大端模式&小端模式、主机序&网络序、入栈地址高低问题
一.大端模式&小端模式 所谓的“大端模式”,是指数据的低位(就是权值较小的后面那几位)保存在内存的高地址中,而数据的高位,保存在内存的低地址中,这样的存储模式有点儿类似于把数据当作字符串顺序处 ...
- 子shell的$$
http://blog.csdn.net/firefoxbug/article/details/7426109
- WPF 利用子线程弹出子窗体的研究
一般来说子线程都是用来处理数据的,主窗体用来实现展现,但是有些时候我们希望子窗体实现等待效果,遮挡主窗体并使主窗体逻辑正常进行,这个业务需求虽然不多,但是正好我们用到了,于是我打算把研究成果写在这了. ...
- vmware 网络连接
解决VMware nat service等服务不能启动 虚拟机如何设置网络连接来上网?
- 2015第10周五CSS—2
经常遇到的浏览器兼容性有哪些?如何解决? 1.浏览器默认的margin和padding不同.解决方案是加一个全局的*{margin:0;padding:0;}来统一. 2.IE6双边距bug:块属性标 ...
- Kth Smallest Element in a BST 解答
Question Given a binary search tree, write a function kthSmallest to find the kth smallest element i ...