n<=400个东西,每个东西有高度<=100,这种东西在堆放过程中不得超过的最大高度<=40000,以及每个东西的个数<=10,求最高能堆多高。

算了下背包复杂度不太对然后开了bitset。。

 #include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<algorithm>
#include<bitset>
//#include<iostream>
using namespace std; int n;
#define maxn 411
struct Obj{int h,m,c;}a[maxn];
bool cmp(const Obj &a,const Obj &b) {return a.m<b.m;}
bitset<> f,tmp,t;
int main()
{
scanf("%d",&n);
for (int i=;i<=n;i++) scanf("%d%d%d",&a[i].h,&a[i].m,&a[i].c);
f.reset();f[]=;
tmp.set();
sort(a+,a++n,cmp);
for (int i=;i<=n;i++)
{
for (int j=;j<=a[i].c;j++)
f|=(f<<a[i].h);
t=tmp<<(a[i].m+);t.flip();
f&=t;
}
int ans;
for (ans=;ans;ans--) if (f[ans]) break;
printf("%d\n",ans);
return ;
}

BZOJ1739: [Usaco2005 mar]Space Elevator 太空电梯的更多相关文章

  1. BZOJ 1739: [Usaco2005 mar]Space Elevator 太空电梯

    题目 1739: [Usaco2005 mar]Space Elevator 太空电梯 Time Limit: 5 Sec  Memory Limit: 64 MB Description The c ...

  2. 【题解】「P6771」[USACO05MAR]Space Elevator 太空电梯

    P6771 这是一道很明显的 dp 问题. 首先 dp 最重要的三要素是:动态表示.动态转移.初始状态. 只要这三个要素搞明白了,基本就能把这题做出来了. solution 让我们来看看这题的动态表示 ...

  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. BZOJ1680: [Usaco2005 Mar]Yogurt factory

    1680: [Usaco2005 Mar]Yogurt factory Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 106  Solved: 74[Su ...

  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. BZOJ 1738: [Usaco2005 mar]Ombrophobic Bovines 发抖的牛( floyd + 二分答案 + 最大流 )

    一道水题WA了这么多次真是.... 统考终于完 ( 挂 ) 了...可以好好写题了... 先floyd跑出各个点的最短路 , 然后二分答案 m , 再建图. 每个 farm 拆成一个 cow 点和一个 ...

  7. A - Space Elevator(动态规划专项)

    A - Space Elevator Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u ...

  8. 1740: [Usaco2005 mar]Yogurt factory 奶酪工厂

    1740: [Usaco2005 mar]Yogurt factory 奶酪工厂 Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 119  Solved:  ...

  9. 1682: [Usaco2005 Mar]Out of Hay 干草危机

    1682: [Usaco2005 Mar]Out of Hay 干草危机 Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 391  Solved: 258[ ...

随机推荐

  1. LN : leetcode 733 Flood Fill

    lc 733 Flood Fill 733 Flood Fill An image is represented by a 2-D array of integers, each integer re ...

  2. P2712 摄像头

    题目描述 食品店里有n个摄像头,这种摄像头很笨拙,只能拍摄到固定位置.现有一群胆大妄为的松鼠想要抢劫食品店,为了不让摄像头拍下他们犯罪的证据,他们抢劫前的第一件事就是砸毁这些摄像头. 为了便于砸毁摄像 ...

  3. ES-Apache Lucene

    前言 在介绍Lucene之前,我们来了解相关的历史. 有必要了解的Apache Apache软件基金会(也就是Apache Software Foundation,简称为ASF)是专门为运作一个开源软 ...

  4. knockout Observable Array(监控数组)

    Observable Array(监控数组)的作用 列表操作是经常会遇到的一个场景,使用监控数组,你可以: 保存列表对象,并且使用Ko提供的丰富的API操作列表元素(支持内建js Array的方法,以 ...

  5. sc服务查询

    sc query lanmanse2rver |find /i "state" |find /i "running" || ( echo 该服务没有运行时,要执 ...

  6. Cognos添加关联字段

    (这是另一个表)

  7. win7创建无线(WIFI)cmd命令

    1.创建无限热点:netsh wlan set hostednetwork mode=allow ssid=name key=12345678. 2.承载网络:netsh wlan start(关闭s ...

  8. 洛谷 P2319 [HNOI2006]超级英雄

    题目描述 题目描述 现在电视台有一种节目叫做超级英雄,大概的流程就是每位选手到台上回答主持人的几个问题,然后根据回答问题的多少获得不同数目的奖品或奖金.主持人问题准备了若干道题目,只有当选手正确回答一 ...

  9. How to Slove MB SD C4 Cannot Access OBD2 Port

    When using china clone mb sd connect compact 4 Multiplexer, it could not link to the car computer, M ...

  10. Android开发案例 - 淘宝商品详情【转】

    http://erehmi.cnblogs.com/ 所有电商APP的商品详情页面几乎都是和淘宝的一模一样(见下图): 采用上下分页的模式 商品基本参数 & 选购参数在上页展示 商品图文详情等 ...