摘要: 题目链接:戳这里 题意:有A只蚂蚁,来自T个家族,每个家族有ti只蚂蚁。任取n只蚂蚁(S <= n <= B),求能组成几种集合? 这道题可以用dp或母函数求。 多重集组合数也是由多重背包问题拓展出来的一类经典问题,而此类问题也都可以用母函数求. 给大家讲2种方法: ①朴素方法: 状态:dp[i][ 阅读全文
posted @ 2018-07-18 22:58 euzmin 阅读(266) 评论(0) 推荐(0) 编辑
摘要: 这段时间刷dp,总结出了一个不算套路的套路。 1.根据题意确定是否有重叠子问题,也就是前面的状态对后面的有影响,基本满足这个条件的就可以考虑用dp了。 2.确定是dp后,就是最难的部分——如何根据题意选定正确的状态,比如dp[i][j]表示前i个物品价格为j的所有可能。(这个需要刷题积累经验,暂时还 阅读全文
posted @ 2018-07-18 22:35 euzmin 阅读(163) 评论(0) 推荐(0) 编辑
摘要: Keeping track of all the cows can be a tricky task so Farmer John has installed a system to automate it. He has installed on each cow an electronic ID 阅读全文
posted @ 2018-07-18 16:21 euzmin 阅读(126) 评论(0) 推荐(0) 编辑
摘要: People in Silverland use coins.They have coins of value A1,A2,A3...An Silverland dollar.One day Tony opened his money-box and found there were some co 阅读全文
posted @ 2018-07-18 15:17 euzmin 阅读(183) 评论(0) 推荐(0) 编辑