301126: CF208C. Police Station
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Police Station
题意翻译
题意简述: 给定$n$个点$m$条边的无向连通图 在其中一个点放置警察局,能使和它相连的边为安全边 问在哪里放置一个警察局,使得以下值最大: $\dfrac{\text{所有最短路中经过的安全边个数}}{\text{最短路的条数}}$ 最短路指的是从$1$到$n$的最短路 请输出这个最大值,误差不超过$10^{-6}$才算正确 $2\leq n\leq 100\quad n-1\leq m\leq \frac{n(n-1)}{2}$题目描述
The Berland road network consists of $ n $ cities and of $ m $ bidirectional roads. The cities are numbered from 1 to $ n $ , where the main capital city has number $ n $ , and the culture capital — number $ 1 $ . The road network is set up so that it is possible to reach any city from any other one by the roads. Moving on each road in any direction takes the same time. All residents of Berland are very lazy people, and so when they want to get from city $ v $ to city $ u $ , they always choose one of the shortest paths (no matter which one). The Berland government wants to make this country's road network safer. For that, it is going to put a police station in one city. The police station has a rather strange property: when a citizen of Berland is driving along the road with a police station at one end of it, the citizen drives more carefully, so all such roads are considered safe. The roads, both ends of which differ from the city with the police station, are dangerous. Now the government wonders where to put the police station so that the average number of safe roads for all the shortest paths from the cultural capital to the main capital would take the maximum value.输入输出格式
输入格式
The first input line contains two integers $ n $ and $ m $ ( $ 2<=n<=100 $ , ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF208C/9b7bf31ae68e1d60fef65c569392a7802b189697.png)) — the number of cities and the number of roads in Berland, correspondingly. Next $ m $ lines contain pairs of integers $ v_{i} $ , $ u_{i} $ ( $ 1<=v_{i},u_{i}<=n $ , $ v_{i}≠u_{i} $ ) — the numbers of cities that are connected by the $ i $ -th road. The numbers on a line are separated by a space. It is guaranteed that each pair of cities is connected with no more than one road and that it is possible to get from any city to any other one along Berland roads.
输出格式
Print the maximum possible value of the average number of safe roads among all shortest paths from the culture capital to the main one. The answer will be considered valid if its absolute or relative inaccuracy does not exceed $ 10^{-6} $ .
输入输出样例
输入样例 #1
4 4
1 2
2 4
1 3
3 4
输出样例 #1
1.000000000000
输入样例 #2
11 14
1 2
1 3
2 4
3 4
4 5
4 6
5 11
6 11
1 8
8 9
9 7
11 7
1 10
10 4
输出样例 #2
1.714285714286