题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1509

题目大意:每一次输入都有序号和优先级,优先级小的先输出,优先级相同的话则序号小的先输出!第一次用优先队列,暂时对优先队列的理解即:输出最小的~AC代码,供参考!

 #include <iostream>
#include <cstdio>
#include <queue>
using namespace std; struct node
{
char str[];
int a,b,c;
bool friend operator <(node n1,node n2)
{
if(n1.b==n2.b)
{
return n1.c>n2.c;
}
return n1.b>n2.b;
}
} s,ss; int main ()
{
//node q;
priority_queue<node>Q;
int k=;
char ch[];
while (cin>>ch)
{
if (ch[]=='G')
{
if (!Q.empty())
{
s=Q.top();
Q.pop();
printf("%s %d\n",s.str,s.a);
}
else
printf("EMPTY QUEUE!\n");
}
else
{
scanf("%s%d%d",s.str,&s.a,&s.b);
s.c=k++;
Q.push(s);
}
}
return ;
}

hdu 1509 Windows Message Queue (优先队列)的更多相关文章

  1. hdu 1509 Windows Message Queue (优先队列)

    Windows Message QueueTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Oth ...

  2. hdu 1509 Windows Message Queue

    题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=1509 Windows Message Queue Description Message queue ...

  3. HDU 1509 Windows Message Queue(队列)

    题目链接 Problem Description Message queue is the basic fundamental of windows system. For each process, ...

  4. hdoj 1509 Windows Message Queue【优先队列】

    Windows Message Queue Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Ot ...

  5. zoj 2724 Windows Message Queue 优先队列

    http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1724 题目大意: 给出两种操作,GET要求取出当前队首的元素,而PUT会输入名 ...

  6. Windows Message Queue(优先队列)

    欢迎参加——BestCoder周年纪念赛(高质量题目+多重奖励) Windows Message Queue Time Limit: 2000/1000 MS (Java/Others)    Mem ...

  7. Windows Message Queue

    Windows Message Queue Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Other ...

  8. zoj 2724 Windows Message Queue

    Windows Message Queue Time Limit: 2 Seconds      Memory Limit: 65536 KB Message queue is the basic f ...

  9. hdu1509(Windows Message Queue) 优先队列

    点击打开链接 Problem Description Message queue is the basic fundamental of windows system. For each proces ...

随机推荐

  1. 不用找了,比较全的signalR例子已经为你准备好了(2)---JqGrid 服务端刷新方式-注释详细-DEMO源码下载

    上次用客户端进行数据刷新的方式,和官方的Demo实现存在差异性,今天花了一点时间好好研究了一下后台时时刷新的方式.将写的代码重新update了一次,在这之前找过好多的资料,发现都没有找到好的例子,自己 ...

  2. 软件测试面试题-适合零基础和工作多年的re

    软件测试面试题整理,可以看看:适合零基础和多年工作经验跳槽的人 有些问题会深挖,就不在整理了 详看图片:

  3. python 基础篇 16 递归和二分数查找与编码补充回顾

    编码回顾补充: 回顾编码问题:        编码相当于密码本,关系到二进制与看懂的文字的的对应关系.    最早期的密码本:        ascii码:只包含英文字母,数字,特殊字符.       ...

  4. 辨析ADK&JVM&JRE&JDK&ADT

    一.SDK 英文全称:Software Development Kit 中文译名:软件开发工具包 详解: 由第三方服务商提供的实现软件产品某项功能的工具包. 为了扩展软件功能或其它方面而设计出来给开发 ...

  5. [译]在Python中如何使用额enumerate 和 zip 来迭代两个列表和它们的index?

    enumerate - 迭代一个列表的index和item <Python Cookbook>(Recipe 4.4)描述了如何使用enumerate迭代item和index. 例子如下: ...

  6. 【转】webpack4

    1.不再支持node.js4.X 2.不能用webpack命令直接打包指定的文件,只能使用webpack.config.js进行配置. 即:webpack  demo01.js  bundle01.j ...

  7. Python中enumerate函数用法详解

    enumerate函数用于遍历序列中的元素以及它们的下标,多用于在for循环中得到计数,enumerate参数为可遍历的变量,如 字符串,列表等 一般情况下对一个列表或数组既要遍历索引又要遍历元素时, ...

  8. python类学习以及mro--多继承属性查找机制

    版权声明:本文为博主原创文章,未经博主允许不得转载. 还记得什么是新式类和旧式类吗? Python中,一个class继承于object,或其bases class里面任意一个继承于object,这个c ...

  9. 微信小程序—setTimeOut定时器的坑

    原文地址: http://fanjiajia.cn/2018/06/27/%E5%BE%AE%E4%BF%A1%E5%B0%8F%E7%A8%8B%E5%BA%8F%E2%80%94setTimeOu ...

  10. PAT 1040 有几个PAT

    https://pintia.cn/problem-sets/994805260223102976/problems/994805282389999616 字符串 APPAPT 中包含了两个单词 PA ...