上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 34 下一页

2012年11月24日

hdu 3466 Proud Merchants(DP)

摘要: 点击打开链接 题意: 有n中物品和m元,n种物品的价格为p,价值为V,当你所有的金钱小于Q时,不进行交易! 要按Q-p从小到大排序。。 #include#include#include#includeusing namespace std;const int MAXN=550;struct No... 阅读全文

posted @ 2012-11-24 17:56 Slege 阅读(86) 评论(0) 推荐(0) 编辑

hdu 3449 Consumer(DP)

摘要: 点击打开链接 题目;依赖背包。。 购物,买相应物品时,必须先买其对应的箱子。。以及n个盒子的价钱和,该盒子中所可以装的物品的价格和价值。 求最大价值!! 一般的: dp[i][j]=dp[i][j-cost[i]]+value[i]; 但需要考虑盒子的价值。故 dp[i][j]=max(dp[i... 阅读全文

posted @ 2012-11-24 17:18 Slege 阅读(85) 评论(0) 推荐(0) 编辑

hdu 3033 I love sneakers!(DP)

摘要: 点击打开链接 题目意思; 分组背包问题,大意**要买鞋,有k种牌子,每种牌子至少买一双鞋子。每双鞋子有标价跟实际价值。求用m多的钱买最多价值的鞋。 其实我觉得这题的难点就在处理“至少”这点上面。 状态方程很多都能推出用 dp[k][m] 来表示 已经买了k种鞋 在有m钱状态下的 鞋的最大... 阅读全文

posted @ 2012-11-24 16:20 Slege 阅读(153) 评论(0) 推荐(0) 编辑

hdu 2955 Robberies(01背包)

摘要: 点击打开链接 题目意思: 01背包的简单变异。。 dp[i]表示偷取i元不被抓的概率。。。 dp[j]=max(dp[j],dp[j-mm[i]]*(1-pp[i])) #include"stdio.h"#include"string.h"#define max(x,y) x>y?x:y;dou... 阅读全文

posted @ 2012-11-24 15:14 Slege 阅读(114) 评论(0) 推荐(0) 编辑

hdu 2255 奔小康赚大钱(最佳匹配)

摘要: 点击打开链接 直接模版。。 #include #include #define Min(X,Y) X<=Y?X:Y;#define SIZE 305#define INF 0x7f7f7f7flong n;long match[SIZE],edge[SIZE][SIZE],lx[SIZE],ly... 阅读全文

posted @ 2012-11-24 14:31 Slege 阅读(105) 评论(0) 推荐(0) 编辑

2012年11月17日

hdu 1864 最大报销额 (DP)

摘要: 点击打开链接 题目意思: 01背包: dp[j]=dp[j-v[i]]+v[i] C++: #include"stdio.h"#include"string.h"int dp[3000001];int v[31],cnt;int main(){ int i,j,n; double q,t; in... 阅读全文

posted @ 2012-11-17 12:22 Slege 阅读(98) 评论(0) 推荐(0) 编辑

hdu 1712 ACboy needs your help (DP)

摘要: 点击打开链接 题目意思: 给你n门课和m天,以及a[i][j] (表示第i门课花费j天所能收获的效益); 求n门课花费m天所能达到的最大效益。。 分组背包;dp[i][j]:i门课花费m天所能达到的最大收益 dp[i][j]=1: dp[i][j]; 2:max(dp[i-1][j],d... 阅读全文

posted @ 2012-11-17 11:10 Slege 阅读(115) 评论(0) 推荐(0) 编辑

hdu 1421 搬寝室 (DP)

摘要: 点击打开链接 题目意思: 给你一个n和n个数,从中选出k个,使疲劳最小。。 疲劳计算方法:(两手物品质量差的平方)。 分析:先进行排序,只有当拿相邻的两个物品时,才有可能最小。。 典型的DP: dp[ i ] [ j ]=min( dp[ i -1] [ j ] , dp[ i-2 ] [ j... 阅读全文

posted @ 2012-11-17 10:33 Slege 阅读(107) 评论(0) 推荐(0) 编辑

2012年11月15日

Codeforces-234C Weather

摘要: 点击打开链接 Scientists say a lot about the problems of global warming and cooling of the Earth. Indeed, such natural phenomena strongly influence all lif... 阅读全文

posted @ 2012-11-15 17:05 Slege 阅读(196) 评论(0) 推荐(0) 编辑

Codeforces-233A Perfect Permutation

摘要: Perfect Permutation Problem Description A permutation is a sequence of integersp1,p2,...,pn, consisting ofn distinct positive integers, each of ... 阅读全文

posted @ 2012-11-15 16:04 Slege 阅读(230) 评论(0) 推荐(0) 编辑

上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 34 下一页

导航