• <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++博客 :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
              69 隨筆 :: 0 文章 :: 28 評(píng)論 :: 0 Trackbacks
             1/*
             2  Name: build priority_queue
             3  Copyright: 
             4  Author: Torres
             5  Date: 29-08-08 10:48
             6  Description: 建立優(yōu)先隊(duì)列的方法 
             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但是是最大優(yōu)先
            27priority_queue<int>SysIntq;//默認(rèn)是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) 評(píng)論(0)  編輯 收藏 引用
            AV无码久久久久不卡网站下载 | 国产成人久久777777| 国产成人久久AV免费| 99精品久久久久久久婷婷| 亚洲国产欧洲综合997久久| 国产精品一久久香蕉产线看| 国产毛片久久久久久国产毛片| 久久精品夜色噜噜亚洲A∨| 久久久久99这里有精品10 | 久久青草国产手机看片福利盒子| 91精品国产高清久久久久久91 | 99国产欧美精品久久久蜜芽| 国内精品久久久久久久久电影网 | 久久精品成人影院| 国色天香久久久久久久小说| 99久久免费只有精品国产| 久久亚洲sm情趣捆绑调教| 伊人丁香狠狠色综合久久| 亚洲乱码中文字幕久久孕妇黑人 | 伊人久久大香线蕉亚洲五月天| 9191精品国产免费久久| 日本欧美久久久久免费播放网| 欧美与黑人午夜性猛交久久久| 国产成人精品免费久久久久| 人妻无码精品久久亚瑟影视| 久久久久亚洲AV无码专区桃色 | 欧美性大战久久久久久| 久久久国产精品福利免费| 色88久久久久高潮综合影院| 久久精品国产乱子伦| 久久这里的只有是精品23| 久久午夜福利电影| 久久av免费天堂小草播放| 久久综合欧美成人| 91精品日韩人妻无码久久不卡 | 性做久久久久久久久浪潮| 久久久久久久综合综合狠狠| 国产高潮国产高潮久久久91 | 韩国三级中文字幕hd久久精品| 69SEX久久精品国产麻豆| 久久婷婷五月综合97色一本一本 |