• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            T9的空間

            You will never walk alone!

              C++博客 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
              69 隨筆 :: 0 文章 :: 28 評論 :: 0 Trackbacks
             1/*
             2  Name: build priority_queue
             3  Copyright: 
             4  Author: Torres
             5  Date: 29-08-08 10:48
             6  Description: 建立優先隊列的方法 
             7*/

             8#include<iostream>
             9#include<vector>
            10#include<queue>
            11using namespace std;
            12template<class T>void print(T &a){while(!a.empty()){cout<<a.top()<<" ";a.pop();}cout<<endl;}
            13typedef struct node{
            14    int x,y;
            15    bool operator<(const node &a)const{
            16        return x>a.x||(x==a.x&&y>a.y);
            17    }

            18}
            node;
            19
            20/*typedef struct data{
            21    double x,y;
            22    bool cmp(data &a){
            23        return x>a.x||(x==a.x&&y>a.y);
            24    }
            25}data;*/

            26priority_queue<int,vector<int>,less<int> >LessIntq;//雖然是less但是是最大優先
            27priority_queue<int>SysIntq;//默認是less
            28priority_queue<int,vector<int>,greater<int> >GreatIntq;
            29priority_queue<node>Nodeq;
            30//priority_queue<data,vector<data>,cmp>Cmpdata;
            31
            32
            33int main()
            34{
            35    int i,temp;
            36    for(i=1;i<=5;i++){
            37        scanf("%d",&temp);
            38        LessIntq.push(temp);
            39        SysIntq.push(temp);
            40        GreatIntq.push(temp);
            41    }

            42    cout<<"LessIntq::";
            43    print(LessIntq);
            44    cout<<"SysIntq::";
            45    print(SysIntq);
            46    cout<<"GreatIntq::";
            47    print(GreatIntq);
            48    cout<<"******************"<<endl;
            49
            50    node ntemp;
            51    for(i=1;i<=5;i++){
            52        scanf("%d%d",&ntemp.x,&ntemp.y);
            53        Nodeq.push(ntemp);
            54    }

            55    cout<<"Nodeq::"<<endl;
            56    for(i=0;i<5;i++){
            57        cout<<Nodeq.top().x<<"::"<<Nodeq.top().y<<endl;
            58        Nodeq.pop();
            59    }

            60
            61/*    data dtemp;
            62    for(i=1;i<=5;i++){
            63        scanf("%lf%lf",&dtemp.x,&dtemp.y);
            64        Cmpdata.push(dtemp);
            65    }
            66    cout<<"Cmpdata::";
            67    for(i=0;i<5;i++){
            68        cout<<Cmpdata.top().x<<"::"<<Cmpdata.top().y<<endl;
            69        Cmpdata.pop();
            70    }*/

            71    return 0;
            72}

            73/****************************************
            742 5 1 3 7
            75LessIntq::7 5 3 2 1
            76SysIntq::7 5 3 2 1
            77GreatIntq::1 2 3 5 7
            78******************
            791 2
            805 6
            812 3
            822 10
            837 7
            84Nodeq::
            851::2
            862::3
            872::10
            885::6
            897::7
            90Press any key to continue
            91*************************************/
            posted on 2008-08-29 11:31 Torres 閱讀(339) 評論(0)  編輯 收藏 引用
            亚洲人成精品久久久久| 亚洲一本综合久久| 久久天天躁狠狠躁夜夜躁2014| 久久人人爽人爽人人爽av| 亚洲?V乱码久久精品蜜桃| 人妻久久久一区二区三区| 狠狠干狠狠久久| 久久91精品国产91| 亚洲成色999久久网站| 久久有码中文字幕| 狠狠色丁香久久综合五月| 少妇被又大又粗又爽毛片久久黑人 | 久久综合中文字幕| 久久综合亚洲鲁鲁五月天| 国产99久久精品一区二区| 亚洲国产成人精品女人久久久| 久久综合狠狠综合久久综合88| 久久国产精品视频| 99精品久久精品一区二区| 中文精品久久久久人妻| 国产精品内射久久久久欢欢| 色偷偷偷久久伊人大杳蕉| 久久久久亚洲精品男人的天堂| 久久天堂AV综合合色蜜桃网| 伊人精品久久久久7777| 爱做久久久久久| 国产精品久久亚洲不卡动漫| 中文字幕日本人妻久久久免费| 亚州日韩精品专区久久久| 国产精品无码久久四虎| 亚洲国产成人久久综合碰碰动漫3d | 精品视频久久久久| 久久综合狠狠色综合伊人| 久久久久免费看成人影片| 久久精品中文无码资源站| 亚洲国产精品一区二区三区久久| 国内精品免费久久影院| 热99re久久国超精品首页| 国产A级毛片久久久精品毛片| 精品一区二区久久久久久久网站| 久久婷婷五月综合97色|