2358: 【作】【入门】两点之间的最短路径

内存限制:128 MB 时间限制:1.000 S
评测方式:文本比较 命题人:
提交:0 解决:0

题目描述

在一个地图上有 lns="http://www.w3.org/1998/Math/MathML"> 个点,每个点给出其对应的坐标,有些点之间有路径可达(两点之间有线),有些点之间没有。

请编程求解从一个点到另一个点的最短路径长度。

输入

输入文件共 lns="http://www.w3.org/1998/Math/MathML">++3 行,其中:

第一行为整数 lns="http://www.w3.org/1998/Math/MathML">lns="http://www.w3.org/1998/Math/MathML">100),表示地图上有 lns="http://www.w3.org/1998/Math/MathML"> 个点。

第 lns="http://www.w3.org/1998/Math/MathML">2 行到第 lns="http://www.w3.org/1998/Math/MathML">+1 行(共 lns="http://www.w3.org/1998/Math/MathML"> 行) ,每行两个整数 lns="http://www.w3.org/1998/Math/MathML"> 和 lns="http://www.w3.org/1998/Math/MathML"> ,描述了一个点的坐标(每个点的坐标均在lns="http://www.w3.org/1998/Math/MathML">10000~lns="http://www.w3.org/1998/Math/MathML">10000之间)。

第 lns="http://www.w3.org/1998/Math/MathML">+2 行为一个整数 lns="http://www.w3.org/1998/Math/MathML">,表示图中连线的个数。(lns="http://www.w3.org/1998/Math/MathML">10000

此后的 lns="http://www.w3.org/1998/Math/MathML"> 行,每行描述一条连线,由两个整数 lns="http://www.w3.org/1998/Math/MathML"> 和 lns="http://www.w3.org/1998/Math/MathML"> 组成,表示第 lns="http://www.w3.org/1998/Math/MathML"> 个点和第 lns="http://www.w3.org/1998/Math/MathML"> 个点之间有连线。

最后一行:两个整数 lns="http://www.w3.org/1998/Math/MathML"> 和 lns="http://www.w3.org/1998/Math/MathML"> ,分别表示源点和目标点是我们读入的 lns="http://www.w3.org/1998/Math/MathML"> 个点中的第几个点。

输出

输出文件仅一行,一个实数(保留两位小数),表示从 lns="http://www.w3.org/1998/Math/MathML"> 到 lns="http://www.w3.org/1998/Math/MathML"> 的最短路径长度。

样例输入 复制

5
0 0
2 0
2 2
0 2
3 1
5 
1 2 
1 3 
1 4 
2 5 
3 5 
1 5

样例输出 复制

3.41