CF1593E Gardener and Tree
题目描述
一棵 $n$ 个结点的树。一个人做了多次操作,在每次操作中,他删除了树的所有叶结点。叶结点指的是树中至多有一个相邻节点的结点。
![](http://61.186.173.89:2019/2021/10/15/c4f2d0e1827d5.png)
如上图中所示的树。下图显示了对树进行一次操作后的结果。
![](http://61.186.173.89:2019/2021/10/15/14602247d6f15.png)
注意特殊操作的情况:
1、对空树($0$ 个顶点)进行操作时不会改变它;
2、对于仅有一个顶点的树进行操作时会移除这个顶点(这个顶点被当作一个叶子);
3、对于仅有两个顶点的树进行操作时将删除两个顶点(两个顶点都被当作叶子处理)。
求 $k$ 次操作后还剩下多少个顶点?
输入格式
无
输出格式
无
说明/提示
The first test case is considered in the statement.
The second test case contains a tree of two vertices. $ 200000 $ operations are applied to it. The first one removes all two vertices, the other operations do not change the tree.
In the third test case, a tree of three vertices is given. As a result of the first operation, only $ 1 $ vertex remains in it (with the index $ 2 $ ), the second operation makes the tree empty.