• <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 閱讀(134) 評論(0)  編輯 收藏 引用 所屬分類: 動態規劃
            <2025年5月>
            27282930123
            45678910
            11121314151617
            18192021222324
            25262728293031
            1234567

            常用鏈接

            留言簿

            隨筆檔案(14)

            文章分類(8)

            文章檔案(11)

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            欧美亚洲另类久久综合| 伊人色综合久久天天| 久久精品无码一区二区app| 精品水蜜桃久久久久久久| 久久精品久久久久观看99水蜜桃| 伊人久久大香线蕉综合热线| 久久久久亚洲精品无码蜜桃| 久久久WWW成人| 亚洲精品乱码久久久久久按摩 | 国产精品美女久久久| 欧美日韩精品久久久免费观看| 波多野结衣AV无码久久一区| 国产免费久久精品99久久| 72种姿势欧美久久久久大黄蕉| 亚洲综合久久综合激情久久| 国内精品伊人久久久久妇| 国产精品成人久久久| 青青青青久久精品国产h| 狠狠精品久久久无码中文字幕| 欧美久久精品一级c片片| 亚洲精品tv久久久久久久久| 久久精品中文字幕一区| 久久精品国产精品青草| 激情五月综合综合久久69| 久久精品国产精品亚洲毛片| 久久精品中文字幕大胸| 99久久国产亚洲高清观看2024| 人妻精品久久无码区| 久久99精品国产麻豆宅宅| 乱亲女H秽乱长久久久| 久久人人爽人人爽人人片AV东京热| 国内精品久久久久影院网站| 精品久久香蕉国产线看观看亚洲| 色欲久久久天天天综合网| 久久综合色区| 久久无码人妻一区二区三区| 国产精品99久久久久久宅男小说| 久久男人中文字幕资源站| 色婷婷综合久久久久中文字幕 | 久久国产福利免费| 国产毛片久久久久久国产毛片|