2617: 火热的房地产(使用优先级队列,STL库)
2010-03-18 19:28
274 查看
#include<iostream>
#include<queue>
using namespace std;
int main()
{
freopen("in.txt","r",stdin);
freopen("out.txt","w",stdout);
int n,x,t;
while(1)
{
priority_queue< int ,vector<int> ,greater<int> > q;
while((scanf("%d",&n),n)!=0)
{
if(n==-1) break;
if(n==1)
{
if(!q.empty())
{
t=q.top();
q.pop();
printf("%d/n",t);
}
}
else
if(n==2)
{
scanf("%d",&x);
q.push(x);
}
}
if(n==-1) break;
printf("/n");
}
return 0;
}
#include<queue>
using namespace std;
int main()
{
freopen("in.txt","r",stdin);
freopen("out.txt","w",stdout);
int n,x,t;
while(1)
{
priority_queue< int ,vector<int> ,greater<int> > q;
while((scanf("%d",&n),n)!=0)
{
if(n==-1) break;
if(n==1)
{
if(!q.empty())
{
t=q.top();
q.pop();
printf("%d/n",t);
}
}
else
if(n==2)
{
scanf("%d",&x);
q.push(x);
}
}
if(n==-1) break;
printf("/n");
}
return 0;
}
相关文章推荐
- C++ 优先队列 priority_queue 的基本使用方法【定义优先级】
- 【转】java中PriorityQueue优先级队列使用方法
- java 中PriorityQueue优先级队列使用方法
- C++ priority_queue (优先级队列)的使用
- 接水问题——使用优先级队列进行维护
- java中PriorityQueue优先级队列使用方法
- 基础入门_Python-模块和包.深入Celery之使用队列以及优先级提高响应?
- 优先级队列的使用
- java中PriorityQueue优先级队列使用方法
- C++ 标准模板库STL 优先级队列 priority_queue 使用方法与应用介绍(一)
- 数据结构复习:栈队列 优先级队列 已经使用栈来解析和运算数学表达式
- 使用NSOperationQueue简化多线程开发 (二) 队列的优先级
- 【day0414 C++】优先级队列 priority_queue的使用
- 使用NSOperationQueue简化多线程开发和队列的优先级
- 深入Celery之使用队列以及优先级提高响应
- java中PriorityQueue优先级队列的使用
- Linux下使用hiredis库实现优先级队列
- Merge k Sorted Lists ,优先级队列(堆)的使用
- 使用优先级队列求一个大数组中的前k个最大的数(或前k个最小的数)
- java中PriorityQueue优先级队列使用方法