• <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 閱讀(140) 評論(0)  編輯 收藏 引用 所屬分類: 動態規劃
            <2025年7月>
            293012345
            6789101112
            13141516171819
            20212223242526
            272829303112
            3456789

            常用鏈接

            留言簿

            隨筆檔案(14)

            文章分類(8)

            文章檔案(11)

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            色婷婷综合久久久中文字幕| 精品久久久久久国产| 久久无码高潮喷水| 亚洲AV无码1区2区久久| 国产精品久久永久免费| 久久免费99精品国产自在现线| 欧美日韩精品久久久久| 亚洲精品无码久久久久sm| 国产精品久久久久AV福利动漫| 国产精品99久久久精品无码| 一本色道久久综合狠狠躁| 国产亚洲成人久久| 久久人爽人人爽人人片AV| 国产一区二区三精品久久久无广告| 午夜精品久久久久久影视riav| 亚洲成色999久久网站| 久久精品无码专区免费青青 | 久久青草国产手机看片福利盒子| 欧美久久一级内射wwwwww.| 国产精品无码久久综合| 久久人人爽人爽人人爽av| 久久成人国产精品| 久久精品一本到99热免费| 久久一区二区三区99| 久久久久久久99精品免费观看| 97精品伊人久久大香线蕉| 久久精品成人免费国产片小草| 精品免费久久久久国产一区| 久久精品国产亚洲AV麻豆网站 | 日韩人妻无码精品久久免费一| 国产精品成人99久久久久91gav| 久久99久久成人免费播放| 99久久精品国内| 成人免费网站久久久| 久久精品aⅴ无码中文字字幕不卡 久久精品aⅴ无码中文字字幕重口 | 狠狠精品久久久无码中文字幕| 伊人久久大香线蕉综合Av| 伊人久久亚洲综合影院| 精品无码久久久久国产动漫3d| 人妻中文久久久久| 久久人妻AV中文字幕|