• <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 閱讀(645) 評論(0)  編輯 收藏 引用 所屬分類: 題目分類:數據結構
            人妻系列无码专区久久五月天| 精品综合久久久久久97超人| 青青久久精品国产免费看| 欧美性猛交xxxx免费看久久久 | 久久久久成人精品无码中文字幕 | av无码久久久久不卡免费网站 | 国产 亚洲 欧美 另类 久久| 久久99国产精品成人欧美| 一本色道久久88综合日韩精品| 久久丫精品国产亚洲av| 国产无套内射久久久国产| 亚洲精品无码专区久久久| 国产福利电影一区二区三区久久久久成人精品综合 | 久久水蜜桃亚洲av无码精品麻豆| 青青草国产成人久久91网| 久久91精品国产91久| 国产A级毛片久久久精品毛片| 99精品久久精品一区二区| 久久精品国产一区| 精品久久久无码人妻中文字幕| 99久久精品免费| 久久精品9988| 999久久久无码国产精品| 久久久久久精品免费看SSS| 久久久久九国产精品| 777久久精品一区二区三区无码| 日产精品99久久久久久| 久久久久精品国产亚洲AV无码| 日本欧美国产精品第一页久久| 久久99国产精一区二区三区| 91精品国产高清91久久久久久| av色综合久久天堂av色综合在 | 亚洲欧美精品一区久久中文字幕 | 久久国产AVJUST麻豆| 国产高潮国产高潮久久久91 | 国产成人久久精品二区三区| 久久久综合九色合综国产| 久久福利青草精品资源站| 国产精品久久久久久| 热久久国产精品| 久久久WWW成人免费精品|