
12-树的最大直径
文章平均质量分 76
DTL66
细节决定成败
展开
-
E - Farthest Nodes in a Tree
E - Farthest Nodes in a TreeTime Limit:2000MS Memory Limit:32768KB 64bit IO Format:%lld & %llu SubmitStatus Description Given a tree (a connected graph with no cycles), you have to find the原创 2016-08-02 15:54:25 · 239 阅读 · 0 评论 -
B - Roads in the North POJ-2631
B - Roads in the NorthTime Limit:1000MS Memory Limit:65536KB 64bit IO Format:%lld & %llu SubmitStatus Description Building and maintaining roads among communities in the far North is an expe原创 2016-08-02 17:23:41 · 382 阅读 · 0 评论 -
A - Cow Marathon POJ-1985
A - Cow MarathonTime Limit:2000MS Memory Limit:30000KB 64bit IO Format:%lld & %llu SubmitStatus Description After hearing about the epidemic of obesity in the USA, Farmer John wants his cows原创 2016-08-02 17:54:24 · 350 阅读 · 0 评论 -
HDU-2196 Computer
D - ComputerTime Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u SubmitStatus Description A school bought the first computer some time ago(so this computer’s id is 1). During原创 2016-08-02 23:43:30 · 354 阅读 · 0 评论 -
POJ-1383 Labyrinth
C - Labyrinth Time Limit:2000MS Memory Limit:32768KB 64bit IO Format:%lld & %llu SubmitStatus Description The northern part of the Pyramid contains a very large and complicated labyrinth. T原创 2016-08-02 20:02:36 · 666 阅读 · 0 评论 -
树的直径学习总结
a.树的性质: .树中所有节点都是连通的;树上的任意连两点间只有一跳通路,即数中不能含有环; 性质1&2->含有n个节点的树有n-1条边;树中任意节点的父节点只有一个,根节点除外;性质4决定了一棵树只能含有一个根节点。 注意:通过树的性质判断一个图是不是树。那就是判断图中所有节点是否连通(用并查集判断根节点是否唯一),图中是否含有环(判断边数是否为n-1)。一棵树的·根节点有且只有一个,原创 2016-08-03 00:14:08 · 373 阅读 · 0 评论