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 ...
随机推荐
- Nightmare(DFS)
Nightmare hdu1072 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Oth ...
- What is an http upgrade?
HTTP Upgrade is used to indicate a preference or requirement to switch to a different version of HTT ...
- ubuntu 中c 语言编程(学习)
ubuntu下c编程 c编程中相关文件后缀 .a 静态库(archive .c C源代码(需要编译预处理) .h C源代码头文件 .i C源代码 (不需要编译预处理) ...
- WPF笔记(1.6 数据绑定)——Hello,WPF!
原文:WPF笔记(1.6 数据绑定)--Hello,WPF! 这个一节都是在讲一个数据绑定的示例.功用:输入姓和名,点击Add按钮,ListBox增加一条记录,永远是字符串“name: nick”:L ...
- ListView.setOnItemClickListener无效
如果ListView中的单个Item的view中存在checkbox,button等view,会导致ListView.setOnItemClickListener无效, 事件会被子View捕获到,Li ...
- bzoj1644 [Usaco2007 Oct]Obstacle Course 障碍训练课
Description 考虑一个 N x N (1 <= N <= 100)的有1个个方格组成的正方形牧场.有些方格是奶牛们不能踏上的,它们被标记为了'x'.例如下图: . . B x . ...
- 生成excel文件
java操作Excel最常用的开源组件有poi与jxl.jxl是韩国人开发的,发行较早,但是更新的很慢,目前似乎还不支持excel2007.poi是apache下的一个子项目,poi应该是处理ms的o ...
- PHP安装和配置
编译安装php5-5.2.6-49.11.src.rpm: ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin ...
- JAVA JNI
jni非常好的一篇文章 http://m.blog.csdn.net/article/details?id=22827307 JAVA JNI介绍 http://blog.csdn.net/cyg08 ...
- structs2标签
Struts2常用标签总结 一 介绍 1.Struts2的作用 Struts2标签库提供了主题.模板支持,极大地简化了视图页面的编写,而且,struts2的主题.模板都提供了很好的扩展性.实现了更好的 ...