• <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>
            posts - 14,  comments - 4,  trackbacks - 0
            按照發起人離開的時間從小到大排序,然后就是一個0-1背包問題,要注意的是活動持續時間小于j


             1#pragma warning(disable : 4786)
             2#include<iostream>
             3#include<string>
             4#include<cstring>
             5#include <algorithm>
             6#include<vector>
             7using namespace std;
             8
             9struct load 
            10{
            11    int h;
            12    int l;
            13    int t;
            14}
            ;
            15load souc[31];
            16bool cmp(const load &a,const load &b)
            17{
            18    return a.t < b.t;
            19}

            20int main()
            21{
            22    int n;
            23    int i,j;
            24    int maxv;
            25    while (scanf("%d",&n)==1 && n>0)
            26    {
            27        vector <int> f;
            28        maxv=0;
            29        for (i=0;i<n;++i)
            30        {
            31            scanf("%d%d%d",&souc[i].h,&souc[i].l,&souc[i].t);
            32            if (souc[i].t > maxv)
            33            {
            34                maxv = souc[i].t;
            35            }

            36        }

            37        sort(souc,souc+n,cmp);
            38        f.resize(maxv+1);
            39        fill(f.begin(),f.end(),0);
            40        int t=0;
            41        for (i=0;i<n;++i)
            42        {
            43            for (j=maxv;j>=souc[i].l;--j)
            44            {
            45                if (souc[i].t >= j)
            46                {
            47                    f[j] = f[j]>f[j-souc[i].l]+souc[i].h?f[j]:f[j-souc[i].l]+souc[i].h;
            48                    if (f[j] > t)
            49                    {
            50                        t = f[j];
            51                    }

            52                }

            53            }

            54        }

            55        cout<<t<<endl;
            56    }

            57    return 0;
            58}

            59
            posted on 2011-05-18 17:39 mr_chen 閱讀(139) 評論(0)  編輯 收藏 引用 所屬分類: 動態規劃
            <2012年3月>
            26272829123
            45678910
            11121314151617
            18192021222324
            25262728293031
            1234567

            常用鏈接

            留言簿

            隨筆檔案(14)

            文章分類(8)

            文章檔案(11)

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            久久国产三级无码一区二区| 久久久网中文字幕| 久久久艹| 久久狠狠色狠狠色综合| 久久久久亚洲av无码专区导航| 亚州日韩精品专区久久久| 国产香蕉97碰碰久久人人| 91精品国产高清91久久久久久| 青青草原精品99久久精品66| 久久精品国产乱子伦| 伊人久久综合成人网| av色综合久久天堂av色综合在| 无码八A片人妻少妇久久| 欧美性猛交xxxx免费看久久久| 久久九九久精品国产| 久久亚洲中文字幕精品一区四 | 99久久精品午夜一区二区| 99蜜桃臀久久久欧美精品网站| 亚洲国产精品成人久久| 国产精品免费看久久久 | 日韩精品久久久肉伦网站 | 久久午夜羞羞影院免费观看| 亚洲国产精品久久久天堂| 久久99久久99精品免视看动漫| 久久免费小视频| 青青热久久国产久精品| 久久精品国产亚洲AV蜜臀色欲 | 久久久无码精品亚洲日韩按摩| 久久亚洲欧美国产精品| 热久久国产精品| 亚洲午夜福利精品久久| 午夜天堂av天堂久久久| 91精品日韩人妻无码久久不卡| 国产成人综合久久精品尤物| 一本久久免费视频| 久久精品无码专区免费青青| 国内精品久久久久久久久| 久久精品aⅴ无码中文字字幕不卡| 久久精品99久久香蕉国产色戒 | 人妻无码αv中文字幕久久| 久久99精品国产麻豆不卡|