Description One day, Takahashi was given the following problem from Aoki: You are given a tree with N vertices and an integer K. The vertices are numbered 1 through N. The edges are represented by pairs of integers (ai,bi). For a set S of vertices in…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 写个dfs看看是不是每个节点都有3个叶子节点就可以了. [代码] #include <bits/stdc++.h> using namespace std; const int N = 1e3; int n; vector <int> g[N+10]; bool ok = true; int dfs(int x){ if ((int) g[x].size()==0){ return 1; } int len = g…