标签:acm
#include <bits/stdc++.h>
using namespace std;
struct cmp
{
bool operator() (const int a, const int b) const{
return a%10 > b%10;///定义个位数小的优先级大
}
};
int main()
{
priority_queue<int, vector<int>, cmp> pq;
for(int i=0; i<5; i++)
{
int a;
cin>>a;
pq.push(a);
}
while(!pq.empty())
{
cout<<pq.top()<<endl;
pq.pop();
}
return 0;
}
priority_queue<int, vector<int>, greater<int> >则表示越小的整数优先级越大
标签:acm
原文地址:http://blog.csdn.net/dojintian/article/details/44682505