您的位置:首页 > 其它

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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: