题目链接: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. 常用的python模块及安装方法

    adodb:我们领导推荐的数据库连接组件 bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheetahcherrypy:一个WEB frameworkctyp ...

  2. 04-Mysql----初识sql语句

    本节课先对mysql的基本语法初体验. 操作文件夹(库) 增 create database db1 charset utf8; 查 # 查看当前创建的数据库 show create database ...

  3. NO11——01背包

    # include <stdio.h> # include <stdlib.h> # include <string.h> # define max(x,y) x& ...

  4. ArcGIS Server中创建的两个账户有什么区别

    新手常常有这样的疑问: 在安装ArcGIS Server的时候创建的账户和在ArcGIS Server Manager上面创建的账户有什么区别? 解答:前者是是为ArcGIS Server创建的操作系 ...

  5. OpenCV彩色图像转灰度图

    核心函数cvSplit(). #include<cv.h> #include<highgui.h> int main(int argc, char** argv) { IplI ...

  6. WCF 透明代理

    现在我们通过类似的原理创建一个用于模拟WCF服务端和客户端工作原理的模拟程序.[源代码从这里下载] 目录 一.基本的组件和执行流程 二.创建自定义HttpHandler实现对服务调用请求的处理 三.定 ...

  7. 算法(10)Subarray Sum Equals K

    题目:在数组中找到一个子数组,让子数组的和是k. 思路:先发发牢骚,这两天做题是卡到不行哇,前一个题折腾了三天,这个题上午又被卡住,一气之下,中午睡觉,下午去了趟公司,竟然把namespace和cgr ...

  8. ActiveMQ使用详解---相关概念

    一.前言 公司之前使用activeMQ做过一款用于系统之间传递信息的工具,最近才正式投入生产使用,这期间出现了一些比较奇怪的问题,最终发现是没有清晰的了解activeMQ的相关配置以及一些相关概念,借 ...

  9. 批处理之FOR命令

  10. Hibernate关联映射之_一对多

    domain: package org.zln.hibernate.domain; import java.util.Set; /** * 部门Domain对象 * Created by sherry ...