摘要:
leedcode : https://leetcode-cn.com/problems/sum-of-distances-in-tree/ 思路 : 一遍 dfs 可以求到以任意一个点为根,所有点所含孩子的个数,cnt数组记录 考虑每一条边的贡献时,即此边左右节点数相乘 第2遍 dfs, 以其他点为 阅读全文
posted @ 2020-10-06 20:29
楼主好菜啊
阅读(139)
评论(0)
推荐(0)
摘要:
推荐知乎 : https://zhuanlan.zhihu.com/p/69101372 阅读全文
posted @ 2020-10-06 17:25
楼主好菜啊
阅读(90)
评论(0)
推荐(0)
摘要:
//FILE *stdin1; //FILE *stdin2; //freopen("D:/p/BB/11.txt", "r", stdin); //freopen("D:/p/BB/22.txt", "r", stdin2); freopen("D:/p/BB/1_2.txt", "w", std 阅读全文
posted @ 2020-10-06 10:59
楼主好菜啊
阅读(1063)
评论(0)
推荐(0)