2014年11月25日

hdu2955(变形01背包)

摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2955分析:被抓概率可以转换成安全概率,Roy的安全概率大于1-P时都是安全的。抢劫的金额为0时,肯定是安全的,所以dp[0]=1;其他金额初始为最危险的所以概率全为0;#include #include... 阅读全文

posted @ 2014-11-25 22:16 lienus 阅读(135) 评论(0) 推荐(0)

hdu1712(分组背包)

摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1712分析: 典型的分组背包问题,如果不会的可以看一下背包九讲。 看下背包九讲中的描述: for 所有的组k forv=V..0 for 所有... 阅读全文

posted @ 2014-11-25 15:53 lienus 阅读(221) 评论(0) 推荐(0)

hdu1114(完全背包)

摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1114分析:很裸的一道完全背包题,只是这里求装满背包后使得价值最少,只需初始化数组dp为inf;dp[0]=0; 然后直接套入完全背包循环就行了。。。#include #include #include ... 阅读全文

posted @ 2014-11-25 14:19 lienus 阅读(176) 评论(0) 推荐(0)

hdu4004(二分)

摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4004大致题意二分最大跳跃能力,判断是否可以在m次内到达对岸!分析:由于求青蛙最小弹跳能力,所以二分不断枚举能力x,再对x判断是否在m次内到达对岸。。。#include #include #include... 阅读全文

posted @ 2014-11-25 00:33 lienus 阅读(269) 评论(0) 推荐(0)

hdu2870(dp求最大子矩阵)

摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2870分析:分别转换成'a','b','c'三种来求,其实就跟hdu1505一样了。。。#include #include #include #include #include #include #inc... 阅读全文

posted @ 2014-11-25 00:17 lienus 阅读(180) 评论(0) 推荐(0)

导航