• <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)
            99久久无色码中文字幕| 思思久久精品在热线热| 久久本道伊人久久| 久久91精品国产91久久小草| 久久综合久久综合久久| 国产AⅤ精品一区二区三区久久| 欧美国产精品久久高清| 色狠狠久久综合网| 国产精品无码久久综合 | 久久精品国产亚洲7777| 久久涩综合| 久久国产精品77777| 人妻少妇精品久久| 欧美噜噜久久久XXX| 色8激情欧美成人久久综合电| 亚洲综合久久夜AV | 国产激情久久久久影院| 亚洲AV成人无码久久精品老人| 久久精品亚洲福利| 国产三级久久久精品麻豆三级| 亚洲精品乱码久久久久久蜜桃| 久久r热这里有精品视频| 久久综合偷偷噜噜噜色| 久久美女人爽女人爽| 亚洲中文字幕久久精品无码喷水| 久久AⅤ人妻少妇嫩草影院| 欧美大香线蕉线伊人久久| 午夜精品久久久内射近拍高清 | 国产—久久香蕉国产线看观看| 综合网日日天干夜夜久久| 久久亚洲AV永久无码精品| 国产激情久久久久影院小草| 成人综合伊人五月婷久久| 一本色道久久99一综合| 亚洲国产成人久久一区WWW| 久久激情五月丁香伊人| 99久久国产免费福利| 国产福利电影一区二区三区久久久久成人精品综合 | 亚洲国产香蕉人人爽成AV片久久| 久久精品这里只有精99品| 精品熟女少妇aⅴ免费久久|