ACM模板——优先队列

#include <bits/stdc++.h>
using namespace std;

#define _for(i,a,b) for(int i = (a);i < (b);i ++)
const int maxn = 50003;

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;
    pq.push(38);
    pq.push(46);
    pq.push(52);
    pq.push(21);
    int a = pq.top();
    pq.pop();
    cout << a << endl;
    a = pq.top();
    cout << a << endl;
    return 0;
}
优先队列
原文地址:https://www.cnblogs.com/Asurudo/p/10457125.html