NC222477. [USACODec2020S]Cowntagion
描述
输入描述
The first line contains the single integer N. The next N−1 lines each contain two space-separated integers a and b describing a road between farms a and b. Both a and b are in the range 1…N.
输出描述
The minimum number of days until the outbreak could reach every farm.
示例1
输入:
4 1 2 1 3 1 4
输出:
5
说明:
One possible sequence of events corresponding to this example is the following: the number of sick cows in farm 1 doubles and then doubles again, so that after two days, there are 4 sick cows in farm 1. In each of the next 3 days, a sick cow travels from farm 1 to each of farms 2, 3, and 4 respectively. After 5 days, at least 1 sick cow exists at each farm.