• <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 閱讀(336) 評(píng)論(0)  編輯 收藏 引用

            只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            2021国内久久精品| 观看 国产综合久久久久鬼色 欧美 亚洲 一区二区 | 久久久久女人精品毛片| 久久精品国产精品青草| 人人狠狠综合久久亚洲| 久久久久久亚洲AV无码专区| 欧美久久综合性欧美| 久久久国产99久久国产一| .精品久久久麻豆国产精品| 久久久WWW成人免费毛片| 久久综合国产乱子伦精品免费| 国产成人精品久久综合 | 久久久综合香蕉尹人综合网| 精品久久亚洲中文无码| 激情五月综合综合久久69| 亚洲国产欧美国产综合久久| 久久99精品国产麻豆不卡| 久久久免费精品re6| 蜜桃麻豆WWW久久囤产精品| 久久精品国产99国产精偷| 老色鬼久久亚洲AV综合| 色综合久久夜色精品国产| 91精品日韩人妻无码久久不卡| 亚洲精品无码久久久影院相关影片 | 丁香久久婷婷国产午夜视频| 久久久一本精品99久久精品88| 国产激情久久久久影院老熟女| 色8激情欧美成人久久综合电| 亚洲国产精品高清久久久| 久久福利片| 国产成人综合久久精品尤物| 久久99国内精品自在现线| 午夜精品久久久久久中宇| 久久精品亚洲AV久久久无码| 久久亚洲精品国产亚洲老地址 | 国产精品久久影院| 久久久久久国产精品无码超碰| 中文字幕无码免费久久| 婷婷久久久亚洲欧洲日产国码AV | 久久99精品国产自在现线小黄鸭| 亚洲AV日韩AV永久无码久久|