Problem Description 急!灾区的食物依然短缺!为了挽救灾区同胞的生命,心系灾区同胞的你准备自己采购一些粮食支援灾区,现在假设你一共有资金n元,而市场有m种大米,每种大米都是袋装产品,其价格不等,并且只能整袋购买.请问:你用有限的资金最多能采购多少公斤粮食呢? 后记:人生是一个充满了变数的生命过程,天灾.人祸.病痛是我们生命历程中不可预知的威胁.月有阴晴圆缺,人有旦夕祸福,未来对于我们而言是一个未知数.那么,我们要做的就应该是珍惜现在,感恩生活——感谢父母,他们给予我们生命,抚养…
Problem Description Whuacmers use coins.They have coins of value A1,A2,A3...An Silverland dollar. One day Hibix opened purse and found there were some coins. He decided to buy a very nice watch in a nearby shop. He wanted to pay the exact price(witho…
题意:多重背包模型 n种物品 每个m个 问背包容量下最多拿多少 这里要用二进制优化不然会超时 #include<iostream> #include<cstdio> #include<cstring> using namespace std; +; int dp[maxn]; ],c[]; int main(){ int n,m,maxnum; while(cin>>maxnum>>n){ int a,b; ; ;i<=n;i++){…
http://acm.hdu.edu.cn/showproblem.php?pid=5445 题意:现在你要为运动会提供食物,总共需要提供P能量的食物,现在有n种食物,每种食物能提供 t 能量,体积为 u ,并且最多能提供 v 的数量.运载食物的卡车有m种,每种能提供 x 的运输空间,运输花费为 y,最多可以雇佣 z 辆车.食物可以切割后运输.不需要整块一起运输,但只有一整块全部到达时才能提供能量. 现在需要计算出最少需要多少花费. 思路: 因为食物可以切割运输,那么食物的总体积肯定是越小越好,…
题目链接: 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…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1059 题意:输入6个数,每个数ni代表价值为i的物品有ni个.求如果这些物品能均分给两个人,每个人获得的物品的总价值 相同,就输出“Can be divided.”,否则输出“Can't be divided.”:具体格式见输出格式. 思路:本来想用dfs做的,后来发现时间超限了,其实可以用多重背包来做, 每个物品的数量有限,找出是否存在几个物品的价值与物品总价值的一半相同. 参考文章:https:…
There are N different kinds of transport ships on the port. The ith kind of ship can carry the weight of V[i]V[i] and the number of the ith kind of ship is 2c[i]-12^{C[i]} - 12. How many different schemes there are if you want to use these ships to t…
C - Coin Change (III) Time Limit:2000MS Memory Limit:32768KB 64bit IO Format:%lld & %llu Submit Status Practice LightOJ 1233 Description In a strange shop there are n types of coins of value A1, A2 ... An. C1, C2, ... Cn denote the number of…
链接:HDU-2844:Coins 题意:给你n个种类的钱和对应的数量,同统计一下从1到m能够凑成的钱有多少个. 题解:C[i] = 1 + 2 + 4 + ··· + 2^k + a (0 <= a < 2^(k+1)). #include <bits/stdc++.h> using namespace std; ; const int INF = 0x3f3f3f3f; ; ; int n, m; int a[maxn], c[maxn]; int dp[maxn]; int…
//http://www.cnblogs.com/devil-91/archive/2012/05/16/2502710.html #include<stdio.h> #define N 110000 #include<string.h> int dp[N]; int main() { int n,m,i,j,a[N],b[N],k,h; while(scanf("%d%d",&n,&m),n||m) { memset(dp,0,sizeof(d…