[GCOI Round #1 E] Network

[GCOI Round #1 E] Network

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

题目描述

Mr Aoligei became the boss of the network company. There are \(n\) houses (including the company) in his network, N-1 bidirectional channels to connect the nodes, and there always exists a route from any house to another house. Each channel is 1 kilometer long. The company is house \(h\) and the money a house needs to pay is the distance of the route between the company and the house.

Now, Mr Poo lives in house \(t\). He wants to know how much money does he need to pay.

输入格式

The first line of the input file contains two integers: \(n, t, h\).

Following N-1 lines represent the channels in the original network of SN, each pair \((a, b)\) denote that there is a channel between node a and node b.

输出格式

Print out the money he needs to pay.

输入输出样例

Input #1:

5 4 3
3 1
3 4
3 2
4 5

Output #1:

1

GCOI Round #1

未参加
状态
已结束
规则
OI
题目
5
开始于
2021-01-30 08:30
结束于
2021-01-30 18:45
持续时间
10.2 小时
主持人
参赛人数
6