[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