• <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
            哈夫曼樹(shù)。使用堆來(lái)維護(hù)。
            以下是我的代碼:
            /*
             * 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 閱讀(659) 評(píng)論(0)  編輯 收藏 引用 所屬分類(lèi): 題目分類(lèi):數(shù)據(jù)結(jié)構(gòu)
            无码任你躁久久久久久老妇App| 久久精品综合网| 国产成人精品久久综合| 国产亚洲精品自在久久| 三上悠亚久久精品| 国产成人久久精品一区二区三区| 老司机午夜网站国内精品久久久久久久久| 国内精品九九久久久精品| 久久香蕉国产线看观看精品yw| 久久久久久久97| 久久精品天天中文字幕人妻| 午夜精品久久久久久久| 色妞色综合久久夜夜| 国产午夜久久影院| 精品久久久无码中文字幕天天| 久久久久亚洲精品无码网址| 亚洲欧美另类日本久久国产真实乱对白 | 亚洲欧洲中文日韩久久AV乱码| 久久婷婷五月综合成人D啪| 热综合一本伊人久久精品| 国产亚洲精品久久久久秋霞| 久久这里只有精品18| 99久久国产综合精品麻豆| 99久久精品无码一区二区毛片 | 久久九九兔免费精品6| 久久精品国产亚洲AV高清热| 国产一区二区三区久久| 四虎影视久久久免费观看| 久久精品亚洲一区二区三区浴池 | 久久久久亚洲AV无码永不| 老司机国内精品久久久久| 久久影院亚洲一区| 精品亚洲综合久久中文字幕| 亚洲欧美国产精品专区久久| 国产成人无码精品久久久性色 | 久久精品国产亚洲AV香蕉| 精品久久久久久久久久久久久久久| 久久精品国产2020| 婷婷久久精品国产| 久久99亚洲网美利坚合众国| 99久久精品免费观看国产|