-->
当前位置:首页 > 题库

PROGRAMMING:Strange people, strange travel!

Luz5年前 (2021-05-10)题库430
There is a strange country on earth. There are $$n $$cities in this country, but there are only $$n-1 $$roads, but each city can reach each other.
One day, $$DH $$came to this country, but he didn't travel before. He is really a strange person. He came to the country for a trip and wanted to spend as little money as possible to walk through more cities,
He didn't want to go back, because he would spend more money. He was really a stingy man. It is known that $$DH $$can choose any city as the starting point of his trip. Now that he finds you, he wants to know how many cities he can walk through at most.
###Input format:
The first line is an integer, $$n $, indicating the number of cities in the country.
Next, there are $$n-1 $$rows, each with two integers $$(U, V) $$indicating that there is an edge between $$u, V $$.
$$tips$$: $$1<=n<=100000$$
###Output format:
Output a total of a number, indicating how many cities $$DH $$can walk through at most
###Input example:
Here is a set of inputs. For example:
```in
three
1 2
1 3
```
###Output example:
The corresponding output is given here. For example:
```out
three
```
$$tips $$: $$DH $$can travel along the route of city 2 $- > $$City 1 $- > $$city 3.







answer:If there is no answer, please comment