
背包
zzuli-dk
这个作者很懒,什么都没留下…
展开
-
poj 1384 完全背包问题 dp
Piggy-Bank Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 10778 Accepted: 5252 Description Before ACM can do anything, a budget must be prepared and the n原创 2016-09-15 13:05:50 · 341 阅读 · 0 评论 -
hihocoder #1043 : 完全背包
一维数组方法一: #include #include #include #include #include #define LL long long using namespace std; const int inf = 0x3f3f3f3f; const int N = 625; int dp[100005]; int mai原创 2016-09-27 21:40:55 · 359 阅读 · 0 评论 -
poj 1837 Balance 二维背包
#include #include #include #include #include #include #include using namespace std; const int inf = 0x3f3f3f3f; const int MAXN = 1005; int num[MAXN],v[MAXN]; int dp[MAXN], sum[MAXN]; i原创 2017-03-18 18:17:59 · 261 阅读 · 0 评论 -
POJ3624 01背包
题意: 输入的第一行有两个数,第一个是代表有n件物品,第二个表示背包的重量限制。接下来有n行数据,每行 数据包含两个数字。第一个表示这件物品的重量,第二个数字表示这件物品的价值。#include <iostream> #include <cmath> #include <cstring> #include <algorithm> #include <cstdio> #include <cctype原创 2017-04-06 12:33:49 · 462 阅读 · 0 评论 -
hdu 6092 Rikka with Subset
题意:给你一个B数组,m+1个数,分别代表区间【0,m】的对应下标位置的数量,一共有2^n个数,B数组是A数组的所有集合的和的映射,求A数组。#include <bits/stdc++.h> const int MAXN = 100005; using namespace std; typedef long long LL; inline int read() { int f=1, x=0;原创 2017-08-08 20:50:51 · 365 阅读 · 0 评论 -
百度之星 度度熊与邪恶大魔王 完全背包dp
度度熊为了拯救可爱的公主,于是与邪恶大魔王战斗起来。邪恶大魔王的麾下有n个怪兽,每个怪兽有a[i]的生命值,以及b[i]的防御力。度度熊一共拥有m种攻击方式,第i种攻击方式,需要消耗k[i]的晶石,造成p[i]点伤害。当然,如果度度熊使用第i个技能打在第j个怪兽上面的话,会使得第j个怪兽的生命值减少p[i]-b[j],当然如果伤害小于防御,那么攻击就不会奏效。如果怪兽的生命值降为0或以下,那么怪兽就转载 2017-08-06 11:58:35 · 442 阅读 · 0 评论 -
51nod 1007 正整数分组 背包思路题
思路:判断这n个数能组成的数有哪些, 枚举差值,维护最小值。 看到sum的范围小于10000就得想到背包了。。。#include <bits/stdc++.h> using namespace std; const int inf =0x3f3f3f3f; typedef long long LL; const int MAXN = 10005; const int mod = 1e9+7; in原创 2017-09-26 15:59:59 · 260 阅读 · 0 评论 -
1125 咸鱼商店(二分+01背包) “玲珑杯”线上赛
题意:求出满足在背包容量内,背包价值大于k的所有情况中,找到最小价值是最大的那一种情况。#include <iostream> #include <cstdio> #include <cstdlib> #include <algorithm> #include <cstring> #include <string> #include <cmath> #include <map> #include <原创 2017-06-06 16:15:18 · 262 阅读 · 0 评论