世界真的很大
很多经典的图论问题放在树上就显得简单
二分图的最小点覆盖
这里就变成了一个简单的树形DP而已
看题先:
description:
鲍勃喜欢玩电脑游戏,特别是战略游戏,但有时候他无法快速找到解决方案,那么他很伤心。 现在他有以下问题。 他必须捍卫一座中世纪城市,其道路形成一棵树。 他必须将最少数量的士兵放在节点上,以便他们可以观察所有的边缘。 你可以帮助他吗?
您的程序应该找到Bob为给定树提供的最小兵数。
例如树:
![]()
input:
The input contains several data sets in text format. Each data set represents a tree with the following description:
the number of nodes
the description of each node