题目链接: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. 核方法(Kernel Methods)

    核方法(Kernel Methods) 支持向量机(SVM)是机器学习中一个常见的算法,通过最大间隔的思想去求解一个优化问题,得到一个分类超平面.对于非线性问题,则是通过引入核函数,对特征进行映射(通 ...

  2. HDU 4467 Graph(图论+暴力)(2012 Asia Chengdu Regional Contest)

    Description P. T. Tigris is a student currently studying graph theory. One day, when he was studying ...

  3. 关于aspnet_regsql使用方法

    aspnet_regsql命令解释 说明该向导主要用于配置SQL Server数据库,如membership,profiles等信息,如果要配置SqlCacheDependency,则需要以命令行的方 ...

  4. 【PHP】- Apache设置

    Apache配置 1.首先新建一个自己的amp目录(模仿wampserver安装目录),以后的apache,mysql,php都放在此目录下. 2.下载apache 根据自己的系统下载相应的压缩包,我 ...

  5. (转) linux I/O优化 磁盘读写参数设置

    关于页面缓存的信息,可以用cat /proc/meminfo 看到.其中的Cached 指用于pagecache的内存大小(diskcache-SwapCache).随着写入缓存页,Dirty 的值会 ...

  6. incorrect integer value for column 问题解决

    最近在用zend框架,然后装了一个项目,发现注册的时候出现 General error: 1366 Incorrect integer value: '' for column 'user_id' a ...

  7. 列数不固定时怎么使用el-tabel展示数据

    <el-table :data="contents" stripe> <el-table-column v-for="(item, index) in ...

  8. log4j的常用使用方法

    第一步,引入jar包,不做介绍. 第二步,创建以下类(固定写法) package smn.util; import org.apache.log4j.Logger; public class MyLo ...

  9. Reabble.com-KindleRSS新闻杂志订阅

    Reabble.com-KindleRSS新闻杂志订阅 TreeInsertions Tomcat部署war包后,运行时出现如下错误 RectangularCovering Reabble.com-K ...

  10. 【题解】CQOI2017老C的键盘

    建议大家还是不要阅读此文了,因为我觉得这题我的解法实在是又不高效又不优美……只是想要记录一下,毕竟是除了中国象棋之外自己做出的组合dp第一题~ 首先如果做题做得多,比较熟练的话,应该能一眼看出这题所给 ...