hdu 1171 (背包或者母函数问题)】的更多相关文章

Problem Description Nowadays, we all know that Computer College is the biggest department in HDU. But, maybe you don't know that Computer College had ever been split into Computer College and Software College in 2002.The splitting is absolutely a big…
Big Event in HDU Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 51181    Accepted Submission(s): 17486 Problem DescriptionNowadays, we all know that Computer College is the biggest department…
Big Event in HDU Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 28020    Accepted Submission(s): 9864 Problem Description Nowadays, we all know that Computer College is the biggest department…
链接:hdu 1171 题意:这题能够理解为n种物品,每种物品的价值和数量已知,现要将总物品分为A,B两部分, 使得A,B的价值尽可能相等,且A>=B,求A,B的价值分别为多少 分析:这题能够用母函数的思想解,只是求的不是方案数,而是推断尽可能接近总价值的一半的方案是否存在. 也能够用背包思想,每种物品的价值和数量已知,能够将总价值的一半作为容量,求最大价值,也就最接近所求值了 注:数组要开的略微大一点,否则可能WA #include<stdio.h> #include<strin…
题目地址:HDU 1171 还是水题. . 普通的01背包.注意数组要开大点啊. ... 代码例如以下: #include <iostream> #include <cstdio> #include <string> #include <cstring> #include <stdlib.h> #include <math.h> #include <ctype.h> #include <queue> #incl…
Big Event in HDU  HDU1171 就是求一个简单的背包: 题意:就是给出一系列数,求把他们尽可能分成均匀的两堆 如:2 10 1 20 1     结果是:20 10.才最均匀! 三种解法: 多重背包的优化与否:(1031MS) #include<iostream> #include<stdio.h> #include<algorithm> #include<string.h> using namespace std; ]; ],b[];…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1171 Big Event in HDU Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) 问题描述 Nowadays, we all know that Computer College is the biggest department in HDU. But, maybe you…
1171 题意比较简单,这道题比较特别的地方是01背包中,每个物体有一个价值有一个重量,比较价值最大,重量受限,这道题是价值受限情况下最大,也就值把01背包中的重量也改成价值. //Problem : 1171 ( Big Event in HDU ) Judge Status : Accepted #include <cstdio> #include <cstring> #include <algorithm> #include <iostream> us…
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1171 题意:把商品分成两半,如不能均分,尽可能的让两个数相接近.输出结果:两个数字a,b且a>=b. 思路:01背包. 先把商品的总价值计算出来,sum/2做为背包的容量. 然后讲同种商品的多件,存储为不同商品 同样价值的形式,也就是我们用一个一维数组来存储,不用一个二维或是两个一维数组来存. 感想:好久没有做背包的题目了,今天来做,忘了好多思路,这提醒着我,学习不能一直都在学新东西,也要及时的复习.…
http://acm.hdu.edu.cn/showproblem.php?pid=1171 基础的01背包,求出总值sum,背包体积即为sum/2 #include<stdio.h> #include<string.h> #include<algorithm> using namespace std; ],bao[]; int main() { int sum,i,j,k,m,n,a; while(scanf("%d",&n)!=EOF)…