-->
当前位置:首页 > 题库

PROGRAMMING:Finding the shortest path flyod algorithm

Luz5年前 (2021-05-10)题库390
In a city, a new residential area group composed of several (assumed n) districts is built in the outer suburb, and there are road interchanges between the districts. It is planned to build a kindergarten in a residential area (shared by the N communities). Please design a site selection scheme for the kindergarten (in which district), so that the distance from the farthest district to the kindergarten is the shortest.
###Input format:
The first line of input gives the number of cells n (1 ≤ n ≤ 10) and the number of roads m and 1 (for digraph) or 0 (for undirected graph);
The next M line corresponds to the distance between each cell. Each line gives three positive integers, which are the number of two cities (from 1 to n) and the distance between cells.
###Output format:
Outputs the number of the selected cell.
###Input example:
```in
3 5 1
1 2 5
1 3 12
2 3 2
3 1 3
2 1 7
```
###Output example:
```out
two
```







answer:If there is no answer, please comment