#include <iostream>
#include <algorithm>
#define MAXN 40005
using namespace std; struct node
{
int a;
int b;
int c;
}; node _m[]; bool mark[MAXN]; bool op(node a,node b); int main()
{
//freopen("acm.acm","r",stdin);
int n;
int i;
int j;
int k;
int max;
cin>>n; for(i = ; i < n; ++ i)
{
cin>>_m[i].a>>_m[i].b>>_m[i].c;
} memset(mark,false,sizeof(mark)); sort(_m,_m+n,op); mark[] = true; max = ; for(i = ; i < n; ++ i)
{
for(j = max; j >= ; -- j)
{
if(mark[j])
{
int tem;
for(k = ; k <= _m[i].c; ++ k)
{
tem = j + k*_m[i].a;
if(tem > _m[i].b)
{
break;
}
mark[tem] = true;
if(tem > max)
{
max = tem;
}
}
}
}
}
cout<<max<<endl; } bool op(node a,node b)
{
if(a.b < b.b)
{
return true;
}
return false;
}

POJ 2392的更多相关文章

  1. POJ 2392 Space Elevator(贪心+多重背包)

    POJ 2392 Space Elevator(贪心+多重背包) http://poj.org/problem?id=2392 题意: 题意:给定n种积木.每种积木都有一个高度h[i],一个数量num ...

  2. POJ 2392 Space Elevator 贪心+dp

    题目链接: http://poj.org/problem?id=2392 题意: 给你k类方块,每类方块ci个,每类方块的高度为hi,现在要报所有的方块叠在一起,每类方块的任何一个部分都不能出现在ai ...

  3. poj 2392 Space Elevator(多重背包+先排序)

    Description The cows are going to space! They plan to achieve orbit by building a sort of space elev ...

  4. POJ 2392 Space Elevator DP

    该题与POJ 1742的思路基本一致:http://www.cnblogs.com/sevenun/p/5442279.html(多重背包) 题意:给你n个电梯,第i个电梯高h[i],数量有c[i]个 ...

  5. poj[2392]space elevator

    Description The cows are going to space! They plan to achieve orbit by building a sort of space elev ...

  6. DP:Space Elevator(POJ 2392)

    太空电梯 题目大意:一群牛想造电梯到太空,电梯都是由一个一个块组成的,每一种块不能超过这个类型的高度,且每一种块都有各自的高度,有固定数量,问最高能造多高. 这题就是1742的翻版,对ai排个序就可以 ...

  7. poj 2392 多重背包

    题意:有几个砖,给出高度,能放的最大高度和数目,求这些砖能垒成的最大高度 依据lim排个序,按一层一层进行背包 #include<cstdio> #include<iostream& ...

  8. POJ 2392 Space Elevator 背包题解

    多重背包.本题不须要二分优化.相对简单点.由于反复数十分小,小于10. 而添加一个限制每种材料的高度做法.假设使用逆向填表,那么仅仅须要从这个高度往小递归填表就能够了. 还有就是注意要排序,以限制高度 ...

  9. 【多重背包】 poj 2392

    转自:http://blog.csdn.net/wangjian8006 题目大意:有一头奶牛要上太空,他有很多种石头,每种石头的高度是hi,但是不能放到ai之上的高度,并且这种石头有ci个将这些石头 ...

随机推荐

  1. 处理No CPU/ABI system image for target的方法

    处理No CPU/ABI system image for target的方法 最近菩提搭建完成Android开发环境后,在创建安卓模拟器的时候遇到了问题.这个问题就是图片中显示的no CPU/ABI ...

  2. 2018.10.16 spoj Can you answer these queries V(线段树)

    传送门 线段树经典题. 就是让你求左端点在[l1,r1][l1,r1][l1,r1]之间,右端点在[l2,r2][l2,r2][l2,r2]之间且满足l1≤l2,r1≤r2l1\le l2,r1 \l ...

  3. 2018.06.27Going Home(二分图匹配)

    Going Home Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 24716 Accepted: 12383 Descript ...

  4. hdu-1181(bfs)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1181 思路:bfs,就是每次找到匹配麻烦一点,注意如果结尾和开头相同,就不算. #include< ...

  5. ABP框架系列之二十三:(EF-MySql-Integration-EF-MySql-集成)

    Introduction While our default templates designed to work with SQL Server, you can easily modify the ...

  6. Docker 技巧:删除 Docker 容器和镜像

    默认安装完 docker 后,每次执行 docker 都需要运行 sudo 命令,非常浪费时间影响效率.如果不跟 sudo,直接执行 docker images 命令会有如下问题: Get http: ...

  7. vs2010点调试,显示系统找不到指定的文件

    首先,查看“项目”-“属性”-“链接器”-“常规”-“输出文件”,路劲是否是“bin/xxx.exe”,如果是请继续看我的解答,否则请忽略下面的内容.原因是用VS2010加载调试以前的VC6.0下的程 ...

  8. java中线程和并发面试题

    http://www.cnblogs.com/dolphin0520/p/3932934.html http://www.cnblogs.com/dolphin0520/p/3958019.html ...

  9. Apache Struts 2 Documentation Core Developers Guide

    http://struts.apache.org/docs/core-developers-guide.html

  10. @WebService @WebMethod 详解

    形象图解 首先AB均需要@WebService如果 @WebService(endpointInterface="package.B") public class A implem ...