• <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ù)結構
            www久久久天天com| 久久国产精品一区| 久久久亚洲裙底偷窥综合| 久久精品国产男包| 国产99精品久久| 日本高清无卡码一区二区久久| 亚洲性久久久影院| 久久久久国产精品三级网| 亚洲国产精品成人AV无码久久综合影院 | 久久久久综合国产欧美一区二区| 77777亚洲午夜久久多人| 久久er热视频在这里精品| 久久久WWW成人| 久久久久女人精品毛片| 久久免费国产精品| 久久国产亚洲精品麻豆| 波多野结衣久久一区二区| 久久亚洲精品中文字幕三区| 2021国产精品久久精品| 韩国三级中文字幕hd久久精品| 亚洲人成伊人成综合网久久久| 国产精自产拍久久久久久蜜| 久久综合给合久久狠狠狠97色69| 亚洲精品高清一二区久久| 国产亚洲婷婷香蕉久久精品 | 久久WWW免费人成一看片| 中文字幕亚洲综合久久2| 久久精品人成免费| 久久精品国产AV一区二区三区 | 久久久老熟女一区二区三区| 欧美午夜A∨大片久久| 国产成人久久精品二区三区| 久久综合给合久久国产免费| 中文字幕久久波多野结衣av| 四虎国产精品成人免费久久| 久久激情亚洲精品无码?V| 久久中文娱乐网| 91麻精品国产91久久久久| 中文字幕一区二区三区久久网站| 久久99精品综合国产首页| 色偷偷888欧美精品久久久|