A Problem on the Tree
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
Description
You have a tree with vertices. You also have a starting vertex on this tree.
You need to start from vertex and take at most steps. At each step, you can move to any adjacent vertex. You want to know how many different vertices can you pass through at most. (Including the starting vertex )
Input
First line has three integers, .
Next, we have lines. Each line contains two intergers , means there has an edge between vertex and .
Output
One line with one integer, means the maximum number of different vertices that can be passed through.
Sample Input
5 1 4
1 2
1 3
1 4
4 5
Sample Output
4
Tips

The figure shows a feasible solution. Take steps, passed through different vertices.
数据范围