
树形dp
文章平均质量分 61
树形dp
阿克劳斯
太阳就在眼前,何须留恋蜡烛
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
POJ - 1985 Cow Marathon (求树的直径,树上dp模板)
题目链接题目描述给定一个无向图,这个无向图满足其为一棵树,求树的直径的最大值输入格式第一行:两个数,n和m。n表示节点个数,m表示边的个数。接下来有m行,表示m条边:每行的前两个数是这条边连接的两个节点,第三个数是这条边的长度。后面有一个字母,不用管它。输出格式一个整数,树的直径的最大值样例输入7 61 6 13 E6 3 9 E3 5 7 S4 1 3 N2 4 20 W4 7 2 S样例输出52#include<iostream>#include<原创 2021-07-28 21:34:28 · 195 阅读 · 0 评论 -
POJ - 2342 Anniversary party 没有上司的舞会 (树形dp经典题)
题目链接点进去题目链接左下角Descriptions有翻译There is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The University has a hierarchical structure of employees. It means that the supervisor relation forms a tree rooted at the rector V原创 2021-08-10 11:30:22 · 130 阅读 · 0 评论