#P5908. 猫猫和企鹅
猫猫和企鹅
Description
There are residential areas in the kingdom. They are connected by roads, and it is guaranteed that from any residential area you can reach any other one. The length of each road is .
In every residential area except area , there lives a little penguin. One day, a cat starts from residential area and wants to visit some penguins. However, the cat is very lazy and is only willing to visit penguins whose distance from it is at most .
Please tell the cat how many penguins it can visit.
Input Format
The first line contains two integers , with the meanings as described above.
Starting from the second line, there are lines. Each line contains two integers , indicating that there is a road between residential areas and .
Output Format
Output one integer in a single line, indicating how many penguins the cat can visit.
5 1
1 2
1 3
2 4
3 5
2
Hint
For of the testdata, . It is guaranteed that all residential areas are numbered starting from .
Translated by ChatGPT 5
京公网安备 11011102002149号