题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6233 题意:一个树上有m个人,每个人在某个节点上,每个时刻每个人可以和一个与他距离大于 1 的点进行交流,然后往交流的人的方向走一步,当他一个人没有可以交流的人时就不可以走了,问所有人都不走的期望时间是多少. 题解:假设 t 时刻两个距离最远的人的距离为 x,则在 t + 1 时刻这两个人距离为 x - 2,因为这两个人在这一时刻走的方向是一定的,而在 t 时刻距离为 x - 1 的两个人,因为题目…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6241 题意:给你一棵有 n 个结点的树,每个结点初始颜色都为白色,有 A 个条件:结点 x_i 的黑色结点数目不少于 y_i 个,同时有 B 个条件,除了结点 x_j 及其子树外至少有 y_j 个结点,求把最少要染成黑色结点的数目使得满足 A + B 个条件. 题解:参考自:https://blog.csdn.net/u013534123/article/details/78523559 #incl…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6229 参考题解:https://blog.csdn.net/lifelikes/article/details/78452558 https://www.cnblogs.com/cxhscst2/p/8215717.html #include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsig…