# 2007LA 3902 网络(树+贪心)

https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&category=283&page=show_problem&problem=1903

#include <iostream>
#include <vector>
using namespace std;

#define MAXN 1010
vector<int> node[MAXN];//存第i层节点

int n, s, k, father[MAXN];
bool used[MAXN];

void dfs(int u, int fa, int d)//无根树转有根树，计算father数组，根据深度插入node表
{
father[u] = fa;
if (size == 1 && d > k) node[d].push_back(u);//一个
for (int i = 0; i < size; i++)				 //多个
{
}
}

void dfs2(int u, int fa, int d)
{
used[u] = true;
for (int i = 0; i < link[u].size(); i++)
{
if (link[u][i] != fa && d < k) dfs2(link[u][i], u, d + 1);
}
}

int solve()
{
int ans = 0;
memset(used, 0, sizeof(used));
for (int d = n - 1; d > k; d--)
{
for (int i = 0; i < node[d].size(); i++)
{
int u = node[d][i];
if (!used[u]) //未被覆盖
{
int tmp = u;
for (int j = 0; j < k; j++) tmp = father[tmp];//tmp是u的k级祖先
dfs2(tmp, -1 ,0);
ans ++;
}
}
}
return ans;
}

int main()
{
int T;
cin>>T;
while (T--)
{
cin>>n>>s>>k;
for (int i = 1; i <= n; i++)
{
node[i].clear();
}
for (i = 0; i < n - 1; i++)
{
int a, b;
cin>>a>>b;
}