码迷,mamicode.com
首页 >  
搜索关键字:多重背包    ( 610个结果
hdu(1059) Dividing(多重背包)
题意:输入六个数,价值分别为1——6,输入的数代表该价值的物品的个数;求能否平均分。key:如果奇数肯定不能分,直接输出答案。偶数的话,就是多重背包问题。 试过两种做法,第一种是背包九讲的二进制优化,写三个函数,分别是bag01, bagall, bagmulti~第二种是直接多重背包,但很可能tl...
分类:其他好文   时间:2015-02-05 23:11:56    阅读次数:200
POJ 3260 多重背包+完全背包
前几天刚回到家却发现家里没网线 && 路由器都被带走了,无奈之下只好铤而走险尝试蹭隔壁家的WiFi,不试不知道,一试吓一跳,用个手机软件简简单单就连上了,然后在浏览器输入192.168.1.1就能看到他的路由器的一切信息,包括密码,然后打开笔记本……好了,废话不多说,能连上网后第一时间当然是继续.....
分类:其他好文   时间:2015-02-03 00:37:41    阅读次数:347
HDU2191 悼念512汶川大地震遇难同胞——珍惜现在,感恩生活 【多重背包】
Input 输入数据首先包含一个正整数C,表示有C组测试用例,每组测试用例的第一行是两个整数n和m(1   Output 对于每组测试数据,请输出能够购买大米的最多重量,你可以假设经费买不光所有的大米,并且经费你可以不用完。每个实例的输出占一行。   Sample Input 1 8 2 2 100 4 4 100 2   Sample Output 4...
分类:其他好文   时间:2015-01-27 16:29:23    阅读次数:124
hdu 1059 Dividing 多重背包
Marsha and Bill own a collection of marbles. They want to split the collection among themselves so that both receive an equal share of the marbles. This would be easy if all the marbles had the same value, because then they could just split the collection ...
分类:其他好文   时间:2015-01-26 17:08:53    阅读次数:206
(多重背包)poj 1276
Cash MachineTime Limit:1000MSMemory Limit:10000KTotal Submissions:28364Accepted:10125DescriptionA Bank plans to install a machine for cash withdrawal....
分类:其他好文   时间:2015-01-24 22:38:54    阅读次数:274
hdu 2191 珍惜现在,感恩生活(多重背包)
题意:有N元经费,M种大米,每种大米有单袋价格p元,单袋重量h,以及对应袋数c。问最多可以买多重的大米。思路:经典多重背包,用二进制的方法。看代码代码:struct node{ int price,weight,num;}obj[105];int dp[105];int n,m;void Mu...
分类:其他好文   时间:2015-01-23 22:55:30    阅读次数:187
HDU 1059 Dividing 分配(AC代码)多重背包的变形
1 #include 2 using namespace std; 3 int num[6]; 4 int dp[200]; 5 bool divide(int sum) 6 { 7 int k,i,j; 8 for(i=0;ii;j--)11 i...
分类:其他好文   时间:2015-01-23 21:27:27    阅读次数:177
POJ 1276 Cash Machine 多重背包--二进制优化
点击打开链接 Cash Machine Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 28337   Accepted: 10113 Description A Bank plans to install a machine for cash w...
分类:系统相关   时间:2015-01-23 18:20:57    阅读次数:206
uva--11137Ingenuous Cubrency ---dp
多重背包求最优解问题。 代码如下: #include #include #include using namespace std; int V; long long sum[110000]; int w[50]; void Init() { memset(sum,0,sizeof(sum)); sum[0]=1; } void solve() { ...
分类:其他好文   时间:2015-01-22 20:19:07    阅读次数:205
HDU 2191 悼念汶川地震(AC代码)多重背包
0MS 1084K 706B C++这是用“转01背包”实现的,速度还这么快,还需优化不? 1 # include 2 # include 3 int dp[101] ;//转成01背包的解法,没有任何优化。 4 int max(int a,int b) 5 { 6 return ...
分类:其他好文   时间:2015-01-19 12:31:34    阅读次数:129
610条   上一页 1 ... 43 44 45 46 47 ... 61 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!