优先队列 重写优先级

时间:2015-03-10 22:40:54   收藏:0   阅读:190
#include<queue>
#include<vector>
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;  //优先队列的声明
    return 0;
}

 

原文:http://www.cnblogs.com/qyy-goodluck/p/4328390.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!