![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
优先队列
2020/3/16
这个作者很懒,什么都没留下…
展开
-
5502: 打地鼠游戏
题目:http://exam.upc.edu.cn/problem.php?id=5502 思路:先按小鼠出现的时间从小到大排序,用nt记录消耗的时间,当小鼠停留的时间大于nt时,将价值加到总价值上去,否则,用此小鼠的价值和已经加上去的小鼠的最小价值比较,判断是否加上它。用优先队列,因为优先队列默认从大到小排序,所以要将小鼠价值的负值加到队列中。 #include<stdio.h>...原创 2018-07-25 14:29:08 · 257 阅读 · 0 评论 -
优先队列priority_queue详解
转自https://blog.csdn.net/c20182030/article/details/70757660 它的功能强大在哪里呢? 四个字:自动排序。 优先队列的头文件&&声明 首先,你需要 #include<queue> using namespace std; 这两个头文件。 其次,一个优先队列声明的基本格式是:priority_queue&...转载 2018-07-25 14:39:37 · 189 阅读 · 0 评论