• <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
            按照發(fā)起人離開的時(shí)間從小到大排序,然后就是一個(gè)0-1背包問題,要注意的是活動(dòng)持續(xù)時(shí)間小于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) 評(píng)論(0)  編輯 收藏 引用 所屬分類: 動(dòng)態(tài)規(guī)劃

            只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            <2025年7月>
            293012345
            6789101112
            13141516171819
            20212223242526
            272829303112
            3456789

            常用鏈接

            留言簿

            隨筆檔案(14)

            文章分類(8)

            文章檔案(11)

            搜索

            •  

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            中文字幕久久欲求不满| 久久久久国产一区二区| 婷婷久久香蕉五月综合加勒比 | 久久精品国产72国产精福利| 久久WWW免费人成—看片| 久久人人爽人人人人爽AV| 久久精品这里热有精品| 久久伊人精品一区二区三区| 99久久国语露脸精品国产| 色婷婷综合久久久久中文字幕| 蜜臀av性久久久久蜜臀aⅴ| 久久精品成人欧美大片| 久久国产精品成人免费| 久久久久亚洲AV片无码下载蜜桃| 久久香蕉国产线看观看99| 久久久久久国产精品无码下载| 99久久免费国产精品| 国产精品久久久久aaaa| 亚洲va久久久噜噜噜久久男同| 久久久久无码专区亚洲av| 精品午夜久久福利大片| 午夜天堂av天堂久久久| 久久99精品久久久大学生| 久久996热精品xxxx| 一本色道久久88加勒比—综合| 丰满少妇人妻久久久久久| 精品久久久久中文字幕日本| 亚洲午夜久久久久久久久久| 99久久综合国产精品免费 | 亚洲精品乱码久久久久久蜜桃| 久久99国产精品成人欧美| 久久精品无码一区二区三区日韩| 狠狠色丁香婷婷综合久久来| 久久精品国产91久久麻豆自制 | 色偷偷91久久综合噜噜噜噜| 久久精品不卡| 亚洲精品视频久久久| 久久精品综合网| 久久精品国产2020| 亚洲AV无码久久精品成人| 久久精品国产亚洲av影院|