• <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ù)結(jié)構(gòu)
            久久久久亚洲精品无码蜜桃| 伊人色综合九久久天天蜜桃| 久久精品国产亚洲AV麻豆网站| 久久精品中文字幕无码绿巨人| 日本精品久久久久中文字幕8| 91久久成人免费| 久久99热这里只频精品6| 成人久久精品一区二区三区| 日本久久中文字幕| 久久久久久夜精品精品免费啦 | 日本精品久久久久中文字幕8| 亚洲国产精品成人久久蜜臀| 国内精品久久久久| 亚洲精品无码成人片久久| 国产高潮国产高潮久久久91 | 99久久久精品| 囯产极品美女高潮无套久久久| 狠狠人妻久久久久久综合| 久久久久亚洲精品无码蜜桃 | 久久国产亚洲精品无码| 伊人久久一区二区三区无码| 久久嫩草影院免费看夜色| 久久99免费视频| 色综合久久久久无码专区 | 国产麻豆精品久久一二三| 久久99久久99精品免视看动漫| 久久亚洲高清综合| 国产精品久久久久一区二区三区| 国产精品久久久久久久| 99久久婷婷国产综合亚洲| 久久精品国产亚洲av影院| 色偷偷偷久久伊人大杳蕉| 久久国产色av免费看| 国产精品乱码久久久久久软件| 午夜精品久久久久9999高清| 日本加勒比久久精品| 久久综合亚洲色HEZYO社区| 亚洲国产精品久久久天堂| 日本人妻丰满熟妇久久久久久| 蜜臀av性久久久久蜜臀aⅴ麻豆| 人妻少妇久久中文字幕|