• <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)  編輯 收藏 引用 所屬分類: 題目分類:數(shù)據(jù)結(jié)構(gòu)
            久久久久国产精品| 中文字幕久久亚洲一区| 久久精品毛片免费观看| 久久w5ww成w人免费| 国产福利电影一区二区三区久久久久成人精品综合 | 99久久精品国产免看国产一区| 久久精品中文字幕无码绿巨人| 久久线看观看精品香蕉国产| 日本亚洲色大成网站WWW久久| 一本色道久久综合亚洲精品| 老司机国内精品久久久久| 色狠狠久久综合网| 狠狠狠色丁香婷婷综合久久五月| 久久精品成人免费观看97| 日韩精品久久无码中文字幕 | 伊人久久国产免费观看视频| 成人久久精品一区二区三区| 亚洲精品NV久久久久久久久久| 精品国产福利久久久| 亚洲va久久久噜噜噜久久狠狠| 久久精品中文字幕一区| 7777久久亚洲中文字幕| 日韩人妻无码一区二区三区久久| 一本色道久久88综合日韩精品 | 久久久久亚洲AV成人网人人软件| 2021最新久久久视精品爱| 91精品国产91久久久久久蜜臀 | 久久91这里精品国产2020| 国产精品久久久久天天影视| 午夜精品久久久久久99热| 午夜精品久久久久久影视777| 亚洲综合精品香蕉久久网97 | 欧美久久综合性欧美| 久久精品国产精品青草app| 久久人人爽爽爽人久久久| 国产美女亚洲精品久久久综合 | 熟妇人妻久久中文字幕| 亚洲国产精品成人久久| 99精品国产综合久久久久五月天| 亚洲午夜久久久| 亚洲狠狠婷婷综合久久蜜芽|