#P2185. Road Stamp Value
Road Stamp Value
Road Stamp Value
In the country of Palmia, there are N cities connected by roads. Each road connects exactly two cities in both directions, and it is guaranteed that starting from any city it is possible to reach every other city via one or more roads.
Recently, the government has introduced a road stamp system. Every time a car enters a road, it must display a stamp purchased at a cost of 1 PALMIA COIN (1PC). The value of the annual road stamp is defined as the cost of 100 trips between the two most distant cities. Note that the distance between two cities is defined as the minimum number of roads one has to travel through, and hence the cost of one trip between two cities is equal to that distance in PC.
In mathematical terms, if the maximum distance between any two cities (i.e. the diameter of the network) is \(D\), then the value of the road stamp is calculated as:
$$\text{Stamp Value} = 100 \times D.$$Your task is to compute this value.
inputFormat
The first line contains an integer N (2 ≤ N ≤ 105), the number of cities.
Each of the following N-1 lines contains two integers u and v (1 ≤ u, v ≤ N, u ≠ v) indicating that there is a bidirectional road connecting city u and city v.
It is guaranteed that the graph is connected.
outputFormat
Output a single integer, the value of the road stamp, which is equal to 100 times the diameter (i.e. the maximum distance between any two cities).
sample
2
1 2
100
</p>