(二叉堆10.2.1)ZOJ 2724 Windows Message Queue(对结构体使用优先队列)
来源:互联网 发布:云计算的安全问题包括 编辑:程序博客网 时间:2024/05/16 07:49
/* * ZOJ_2724.cpp * * Created on: 2013年11月7日 * Author: Administrator */#include <iostream>#include <cstdio>#include <cstring>#include <queue>using namespace std;struct MES {char str[10];int mes;int p;int id;bool operator<( const MES& b)const {//特别要注意这种写法...if (p != b.p) {return p > b.p;}return id > b.id;}};int main() {char s[26];priority_queue<MES> q;//对结构体使用优先队列MES tmp;while (scanf("%s", s) != EOF) {int index = 0;if (strcmp(s, "PUT") == 0) {scanf("%s %d %d", tmp.str, &tmp.mes, &tmp.p);tmp.id = index++;q.push(tmp);} else {if (q.empty()) {printf("EMPTY QUEUE!\n");} else {tmp = q.top();q.pop();printf("%s %d\n", tmp.str, tmp.mes);}}}return 0;}
- (二叉堆10.2.1)ZOJ 2724 Windows Message Queue(对结构体使用优先队列)
- zoj-2724 Windows Message Queue(二叉堆&&优先队列)
- ZOJ 2724 Windows Message Queue (二叉堆,优先队列)
- ZOJ 2724 Windows Message Queue(二叉堆||优先队列)
- ZOJ 2724 Windows Message Queue(二叉堆or优先队列)
- zoj 2724 Windows Message Queue 优先队列
- zoj 2714 Windows Message Queue(优先队列、简单的二叉堆处理)
- ZOJ 2724/HDU 1509 Windows Message Queue(优先队列)
- ZOJ 2724 Windows Message Queue 堆
- Hdoj 1509 -Windows Message Queue 优先队列最小堆实现
- hdu1509 Windows Message Queue(优先队列)
- Windows Message Queue(priority_queue优先队列)
- hdu 1509 Windows Message Queue 优先队列
- hdoj1509 Windows Message Queue (优先队列)
- hdu 1509 Windows Message Queue(优先队列)
- HDU-1509-Windows Message Queue(优先队列)
- Windows Message Queue(优先队列)
- Windows Message Queue(STL优先队列)
- 韩顺平网页第二十四讲,二十五讲,二十六讲
- [原]在MAC里启动和停止的MySQL和PostgreSQL的的指令
- 做人那点儿事
- 解决pear使用时出现 PHP_PEAR_INSTALL_DIR is not set correctly.
- jQuery插件之表格排序(转后完善)
- (二叉堆10.2.1)ZOJ 2724 Windows Message Queue(对结构体使用优先队列)
- OleDb读Excel
- Android的数据库SQLiteDatabase基础讲解
- VC++6.0调试篇:远程调试
- PS-去除及替换背景色
- Oracle DB 自动SQL 优化
- Oracle System用户修改密码及账号解锁
- 解析字符串
- jeasy ui的下拉列表与下拉树使用说明