![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
动态规划题解
文章平均质量分 75
晁棠
学生党
展开
-
[动态规划] NamomoCamp Daily 8
NamomoCamp Daily 8代码源oj网址http://oj.daimayuan.top/course/10/problem/467题解:由于nnn过大,所以正解绝对不是n2n^2n2的做法,所以我们来考虑m2m^2m2的做法。对于一个障碍点(i,j)(i,j)(i,j),从(1,1)(1,1)(1,1)走到它的方案数是Ci−1+j−1i−1C_{i-1+j-1}^{i-1}Ci−1+j−1i−1个。若我们要走到(u,v)(u,v)(u,v)这个点,障碍点(i,j)(i,j)(i,j)不能原创 2022-03-07 09:19:24 · 179 阅读 · 0 评论 -
[区间DP] NamomoCamp Daily 2
NamomoCamp Daily 2codeforces原题网址https://codeforces.com/problemset/problem/793/D代码源oj网址http://oj.daimayuan.top/problem/437题解:两个地方的条件有点小小的不同,一个是开区间一个是闭区间,但是没什么影响,而且写法也可以规避出现环的情况。题解视频注意记忆化搜索写法会更慢。代码:DP// Good Good Study, Day Day AC.#include <ios原创 2022-02-27 21:47:07 · 294 阅读 · 0 评论 -
[树形DP] The 2021 ICPC Asia Nanjing Regional Contest H题
1.https://codeforces.com/gym/103470/problem/H题意:在一棵树上的每个节点都有不同数量的蝴蝶。当你进入一个节点时,若那个节点上有蝴蝶,你将会抓住那个节点的蝴蝶,但你会惊动那个节点的子节点里的蝴蝶。你从一个节点到另一个节点,并抓到蝴蝶的时间为1秒,被惊动的蝴蝶将会在ti(ti<=3)t_i(t_i<=3)ti(ti<=3)秒后飞走。从顶点1开始,请问最多可以抓到多少蝴蝶?题解:将子树全部分成三种,一种是从子树根节点一直往下做,记为f(x原创 2022-02-27 00:44:24 · 388 阅读 · 0 评论 -
洛谷 P1025 [NOIP2001 提高组] 数的划分
连接:https://www.luogu.com.cn/problem/P1025题目描述将整数nn分成kk份,且每份不能为空,任意两个方案不相同(不考虑顺序)。例如:n=7n=7,k=3k=3,下面三种分法被认为是相同的。1,1,51,1,5;1,5,11,5,1;5,1,15,1,1.问有多少种不同的分法。输入格式n,kn,k(6<n \le 2006<n≤200,2 \le k \le 62≤k≤6)输出格式11个整数,即不同的分法。...原创 2021-03-29 20:41:30 · 324 阅读 · 1 评论 -
uva 562 - Dividing coins
It’s commonly known that the Dutch have invented copper-wire. Two Dutch men were fighting over a nickel, which was made of copper. They were both so eager to get it and the fighting was so fierce, they stretched the coin to great length and thus created co原创 2021-02-24 15:52:41 · 122 阅读 · 0 评论 -
uva 10131 - Is Bigger Smarter?
Some people think that the bigger an elephant is, the smarter it is. To disprove this, you want to take the data on a collection of elephants and put as large a subset of this data as possible into a sequence so that the weights are increasing, but the IQ’原创 2021-02-24 15:46:45 · 100 阅读 · 0 评论 -
uva 11258 - String Partition
John was absurdly busy for preparing a programming contest recently. He wanted to create a ridiculously easy problem for the contest. His problem was not only easy, but also boring: Given a list of non-negative integers, what is the sum of them?However,原创 2021-02-24 15:34:28 · 121 阅读 · 0 评论