内容摘要
【摘要】
n 个村庄之间的有向图,边上的权值 w(i,j) 表示村庄 i 和 j 之间道路长度,且仅表示从 i
到 j 有通道,现要从这 n 个村庄中选择一个村庄新建一所医院,使离医院最远的村庄到医
院的路程最短。
输入相邻的各个村庄的距离和走向,在以邻接带权矩阵表示的 n 个村庄中,求医院建
在何处,使离医院最远的村庄到医院的路径最短,同时计算出各个村庄到医院的距离。
【关键字】:类、构造函数、邻接带权矩阵
【Abstract】
n between the villages to the map, the edge weights w (i, j) indicated that between villages i
and j the length of the road, and only said that there is from i to j-channel, n is from this select
villages a village in the new build hospitals, the farthest village from the hospital to the hospital
the shortest distance.
The importation of various villages adjacent to the distance and direction with the right in the
adjacent matrix of n villages, and where to build hospitals to hospitals as far away from the village
to the hospital the shortest path, at the same time to calculate the various villages distance from the
hospital.
【Keyword】: class、Constructor、Weighted adjacency matrix
实验内容概述
1