#H2026A. A Problem on the Tree
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.
数据范围
相关
在下列比赛中: