10 2015 档案
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1171思路:用一个数组将数据存起来,可以将其转化为01背包 1 #include 2 #include 3 #include 4 #include 5 #include 6 #inclu...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1290思路:n条直线最多能将一个平面分成几个区域其递推公式即为:f(n)=f(n-1)+n;递推一下,就得到f(n)=1/2*(n*n+n)+1;n个平面最多能将一个空间分成几个区域递推公式即为:g(n)...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1249part=3*s*(s-1)+2 1 #include 2 #include 3 main() 4 { 5 int n,s,i,p,m; 6 while(~scanf("%d",&n...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1279 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #inc...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2159思路:二维完全背包,状态转移方程为: f[j][l]=max(f[j][l],f[j-b[i]][l-1]+w[i]); a[i]表示杀死第i个怪所得的经验值,b[i]表示消耗的忍耐度 1 #inc...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2602思路:典型的01背包 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include...
阅读全文
摘要:题目链接:http://www.bnuoj.com/v3/problem_show.php?pid=24252这是四川2012年省赛的一道题,背景:海盗分宝藏。大概题意:给你N种价值的物品,物品有两个属性,一个是数量,一个是价值(价值是以2的ai次方表示的)。为了公平起见,求出宝藏分配的最小差(二进...
阅读全文
摘要:一道简单的规律题,画出二维表将数字分别相加可以发现很明显的对称性题目链接:http://www.bnuoj.com/v3/problem_show.php?pid=24251 1 #include 2 #include 3 #include 4 #include 5 #include 6 usin...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1203思路:01背包问题,求一份都拿不到的概率,状态转移方程dp[j]=min(dp[j],dp[j-val[i]]*p[i])p[i]表示得不到的概率,(1-dp[j])为花费j元得到Offer的最大概...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1513思路:正反分别求一次LCS,利用滚动数组对二取余滚动 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7...
阅读全文

浙公网安备 33010602011771号