2020牛客暑期多校训练营(第二场)C题——Cover the Tree

题目连接c++ 题目大意 给定一个无根树,选择树中全部边至少被一条链覆盖的最小链数。输出最小数字和其中任何一个解决方案。web 解题思路 寻找不相邻的叶子节点,匹配输出。以下图(官方题解)svg #include<bits/stdc++.h> using namespace std; const int MAXN=2e5+100; int k,ans,u,v,root=-1,flag=1,a[MA
相关文章
相关标签/搜索