开朗百合

文章
7
资源
0
加入时间
3年2月3天

hdu 5905 Black White Tree 树dp

我们可以思考对一个子树如果他节点数固定那么黑点数一定是连续变化的,那我们可以很容易想到找到每个子树大小的黑点最大值和最小值也就是dp[i]表示子树大小为i的黑点最大值,dp1[i]为最小值,剩下的就是dp。#include#include#include#include#includeusing namespace std;const int maxn=2004;int dp[m