CF161D Distance in Tree
Description
A tree is a connected graph that doesn't contain any cycles.
The distance between two vertices of a tree is the length (in edges) of the shortest path between these vertices.
You are given a tree with $ n $ vertices and a positive number $ k $ . Find the number of distinct pairs of the vertices which have a distance of exactly $ k $ between them. Note that pairs ( $ v $ , $ u $ ) and ( $ u $ , $ v $ ) are considered to be the same pair.
Input Format
N/A
Output Format
N/A
Explanation/Hint
In the first sample the pairs of vertexes at distance 2 from each other are (1, 3), (1, 5), (3, 5) and (2, 4).