• <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 閱讀(340) 評論(0)  編輯 收藏 引用
            99麻豆久久久国产精品免费| 国产V亚洲V天堂无码久久久| 俺来也俺去啦久久综合网| 国产精品免费看久久久| 99久久国产免费福利| 久久久高清免费视频| 久久精品国产久精国产思思 | 亚洲国产精品成人AV无码久久综合影院 | 少妇无套内谢久久久久| 国内精品久久九九国产精品| 久久噜噜久久久精品66| 亚洲愉拍99热成人精品热久久| 日本免费久久久久久久网站| 久久99热这里只频精品6| 99精品久久久久久久婷婷| 浪潮AV色综合久久天堂| 欧美久久久久久精选9999| 国产91色综合久久免费分享| 久久91精品国产91| 久久er国产精品免费观看8| 亚洲精品无码久久久久去q| 久久最新免费视频| 国产午夜福利精品久久| 久久精品中文字幕一区| 色综合久久88色综合天天| 久久久久久精品成人免费图片| 精品多毛少妇人妻AV免费久久| 99久久免费国产精精品| 少妇久久久久久久久久| 亚洲一区精品伊人久久伊人 | 国产AV影片久久久久久| 精品久久久久久成人AV| 国产69精品久久久久久人妻精品| 久久成人国产精品一区二区| 国产精品欧美亚洲韩国日本久久| 久久精品国产久精国产思思| 久久人爽人人爽人人片AV| 久久综合噜噜激激的五月天| 天天躁日日躁狠狠久久 | 久久香蕉一级毛片| 久久精品国产69国产精品亚洲|