![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
动态规划
xfeifeix
这个作者很懒,什么都没留下…
展开
-
TC SRM551 DIV2 950 countArrangements dp
题目大意:给出由ABC三种颜色的巧克力球,发给len个人,人是围成圈的,相邻的人球的颜色不能相同,求不同分法种数mod一个数。 代码:参考了下别人写的dp。 #include #include #include #include #include #include #include #include #include #include #include #include原创 2012-08-05 22:52:33 · 319 阅读 · 0 评论 -
ZOJ3201 Tree of Tree 树状dp入门
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3201 题目大意:给出一个树,每个点有一个值,选择k个点要求值最大,k各点连成一颗子树,求最大值 代码: #include #include #include #include #define MAXN 105 #define INF 0x7fffff原创 2012-08-06 10:15:46 · 278 阅读 · 1 评论 -
HDU4301 Divide Chocolate DP问题
http://acm.hdu.edu.cn/showproblem.php?pid=4301 题目大意:给你一个2*n的巧克力,每一小块巧克力都长得不同,将其分成k块巧克力有多少种分发。 解题思路:用一个三维dp[i][j][k],i表示正在解第i列,j表示已经被分成了j块,k表示i-1的俩块巧克力是否分开,0表连着,1表没有连着。 另外需要注意__int64可能会MLE,由于mod了一个数原创 2012-07-21 09:29:50 · 424 阅读 · 0 评论