![](https://img-blog.csdnimg.cn/20190918140145169.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
树形dp
文章平均质量分 61
树形dp
阿克劳斯
太阳就在眼前,何须留恋蜡烛
展开
-
POJ - 1985 Cow Marathon (求树的直径,树上dp模板)
题目链接 题目描述 给定一个无向图,这个无向图满足其为一棵树,求树的直径的最大值 输入格式 第一行:两个数,n和m。n表示节点个数,m表示边的个数。 接下来有m行,表示m条边:每行的前两个数是这条边连接的两个节点,第三个数是这条边的长度。后面有一个字母,不用管它。 输出格式 一个整数,树的直径的最大值 样例输入 7 6 1 6 13 E 6 3 9 E 3 5 7 S 4 1 3 N 2 4 20 W 4 7 2 S 样例输出 52 #include<iostream> #include<原创 2021-07-28 21:34:28 · 136 阅读 · 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 · 93 阅读 · 0 评论