• <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>
            心如止水
            Je n'ai pas le temps
            posts - 400,comments - 130,trackbacks - 0
            哈夫曼樹。使用堆來維護。
            以下是我的代碼:
            /*
             * Author:  lee1r
             * Created Time:  2011/8/5 23:46:40
             * File Name: poj3253.cpp
             
            */
            #include
            <iostream>
            #include
            <sstream>
            #include
            <fstream>
            #include
            <vector>
            #include
            <list>
            #include
            <deque>
            #include
            <queue>
            #include
            <stack>
            #include
            <map>
            #include
            <set>
            #include
            <bitset>
            #include
            <algorithm>
            #include
            <cstdio>
            #include
            <cstdlib>
            #include
            <cstring>
            #include
            <cctype>
            #include
            <cmath>
            #include
            <ctime>
            #define L(x) ((x)<<1)
            #define R(x) (((x)<<1)+1)
            #define Half(x) ((x)>>1)
            #define lowbit(x) ((x)&(-(x)))
            using namespace std;
            const int kInf(0x7f7f7f7f);
            const double kEps(1e-8);
            typedef 
            long long int64;
            typedef unsigned 
            long long uint64;

            const int kMaxn(20007);

            int n;
            int64 ans;

            int main()
            {
                
            //freopen("data.in","r",stdin);
                
                
            while(scanf("%d",&n)==1)
                {
                    priority_queue
            < int,vector<int>,greater<int> > q;
                    
                    
            for(int i=1;i<=n;i++)
                    {
                        
            int t;
                        scanf(
            "%d",&t);
                        q.push(t);
                    }
                    
                    ans
            =0;
                    
            while(q.size()>1)
                    {
                        
            int t(q.top());q.pop();
                        t
            +=q.top();q.pop();
                        q.push(t);
                        ans
            +=t;
                    }
                    
            //ans+=q.top();
                    
                    cout
            <<ans<<endl;
                }
                
                
            return 0;
            }
            posted on 2011-08-05 23:59 lee1r 閱讀(652) 評論(0)  編輯 收藏 引用 所屬分類: 題目分類:數(shù)據(jù)結構
            久久99精品久久久久久久久久 | 亚洲色大成网站WWW久久九九| 国产精品内射久久久久欢欢| 国产成人99久久亚洲综合精品| 久久国产高清一区二区三区| 婷婷国产天堂久久综合五月| 久久男人Av资源网站无码软件| 91麻豆精品国产91久久久久久| 欧美成a人片免费看久久| 亚洲国产精品久久电影欧美| 91精品久久久久久无码| 久久久久久久波多野结衣高潮| 国产精品久久久天天影视香蕉 | 久久久久久精品成人免费图片| 久久久久亚洲AV无码永不| 久久精品无码一区二区日韩AV| 亚洲国产精品18久久久久久| 国产无套内射久久久国产| 欧美熟妇另类久久久久久不卡| 狠狠色综合网站久久久久久久| 久久久无码人妻精品无码| 久久妇女高潮几次MBA| 少妇被又大又粗又爽毛片久久黑人| 国产精品久久久久无码av| 亚洲中文字幕无码久久2017| 欧美精品丝袜久久久中文字幕| 久久99精品国产99久久6| 97久久精品国产精品青草| 一本色道久久综合亚洲精品| 欧美日韩中文字幕久久久不卡| 99久久国产免费福利| 亚洲国产精久久久久久久| 久久亚洲高清观看| 日韩精品国产自在久久现线拍| 狠狠久久亚洲欧美专区| 99久久er这里只有精品18| 久久99国产精品尤物| 久久国产免费观看精品3| 国产精品免费看久久久| 国产V综合V亚洲欧美久久| 久久久精品午夜免费不卡|