dp
饮酒在风里
这个作者很懒,什么都没留下…
展开
-
HDU 5418—Victor and World—【状态压缩+floyd】
Victor and WorldTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 262144/131072 K (Java/Others)Total Submission(s): 891Accepted Submission(s): 399Problem DescriptionAfter trying har...原创 2019-07-06 20:06:41 · 208 阅读 · 0 评论 -
混合背包
有NN种物品和一个容量是VV的背包。物品一共有三类:第一类物品只能用1次(01背包); 第二类物品可以用无限次(完全背包); 第三类物品最多只能用sisi次(多重背包);每种体积是vivi,价值是wiwi。求解将哪些物品装入背包,可使物品体积总和不超过背包容量,且价值总和最大。输出最大价值。输入格式第一行两个整数,N,VN,V,用空格隔开,分别表示物品种...原创 2019-09-06 11:57:26 · 220 阅读 · 0 评论 -
多重背包二进制优化
#include <iostream>#include <cstring>#include <cstdio>#include <queue>#include <cmath>using namespace std;#define mem(f, x) memset(f,x,sizeof(f))#define sca(x) s...原创 2019-09-06 10:47:54 · 106 阅读 · 0 评论 -
HUD 1176 免费馅饼
数塔 简单dp从最后一秒开始倒推,特判每一秒的0和10位置#include<iostream>#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;int dp[100001][12];int main(){ int n,x,...原创 2018-10-29 20:11:00 · 166 阅读 · 0 评论 -
HDU2602 01背包
#include <iostream>#include <ctime>#include <cstdlib>#include <string.h>#include<cstdio>#include<algorithm>using namespace std;int a[1001];//存储每个物品的价值int ...原创 2018-11-19 20:04:19 · 116 阅读 · 0 评论 -
HDU 1114 完全背包
#include <iostream>#include <ctime>#include <cstdlib>#include <string.h>#include<cstdio>#include<algorithm>using namespace std;int dp[10001];int main(){...原创 2018-11-19 21:46:53 · 152 阅读 · 0 评论 -
codeforce 455A. Boredom(经典dp水题)
A. Boredomtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAlex doesn't like boredom. That's why whenever he gets bored, he comes ...翻译 2019-05-20 20:05:53 · 556 阅读 · 0 评论 -
状压dp(方格取数)详解
#include <iostream>#include <algorithm>#include <math.h>#include <vector>#include<cstdio>#include <cstring>#include<bitset>typedef long long ll;usi...原创 2019-07-06 08:48:57 · 369 阅读 · 0 评论 -
状压dp UVa 10911 - Forming Quiz Teams
You have been given the job of forming the quiz teams for the next ‘MCA CPCI Quiz Championship’. There are2*Nstudents interested to participate and you have to formNteams, each team consisting of t...原创 2019-07-06 17:59:27 · 191 阅读 · 0 评论 -
分组背包
有NN组物品和一个容量是VV的背包。每组物品有若干个,同一组内的物品最多只能选一个。每件物品的体积是vijvij,价值是wijwij,其中ii是组号,jj是组内编号。求解将哪些物品装入背包,可使物品总体积不超过背包容量,且总价值最大。输出最大价值。输入格式第一行有两个整数N,VN,V,用空格隔开,分别表示物品组数和背包容量。接下来有NN组数据:...原创 2019-09-06 16:23:48 · 201 阅读 · 0 评论