文件名称:OnesTrip
-
所属分类:
- 标签属性:
- 上传时间:2013-06-16
-
文件大小:676byte
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
一个人的旅行,应用dijkstra
输入数据有多组,每组的第一行是三个整数T,S和D,表示有T条路,和草儿家相邻的城市的有S个,草儿想去的地方有D个;
接着有T行,每行有三个整数a,b,time,表示a,b城市之间的车程是time分钟;(1=<(a,b)<=1000 a,b 之间可能有多条路)
接着的第T+1行有S个数,表示和草儿家相连的城市;
接着的第T+2行有D个数,表示草儿想去地方。
输出ZJB能去某个喜欢的城市的最短时间,如都不能到达,输出-1。-A person' s travel, the application of the input data dijkstra how groups of three integers is the first line of T, S and D, expressed T road, and adjacent to the city' s grass house with S a, grass want to go there are D Then there are T lines, each line contains three integers a, b, time, represents a, b drive between cities is time minutes (1 = < (a, b) < = 1000 a, b possible between multiple routes) followed by the first line of the S T+1 number, which means that the grass family and is connected to a city followed by the first T+2 line with the D number, which means that the grass to go places. Output ZJB able to go to a favorite city of the shortest time, if can not arrive, output-1.
输入数据有多组,每组的第一行是三个整数T,S和D,表示有T条路,和草儿家相邻的城市的有S个,草儿想去的地方有D个;
接着有T行,每行有三个整数a,b,time,表示a,b城市之间的车程是time分钟;(1=<(a,b)<=1000 a,b 之间可能有多条路)
接着的第T+1行有S个数,表示和草儿家相连的城市;
接着的第T+2行有D个数,表示草儿想去地方。
输出ZJB能去某个喜欢的城市的最短时间,如都不能到达,输出-1。-A person' s travel, the application of the input data dijkstra how groups of three integers is the first line of T, S and D, expressed T road, and adjacent to the city' s grass house with S a, grass want to go there are D Then there are T lines, each line contains three integers a, b, time, represents a, b drive between cities is time minutes (1 = < (a, b) < = 1000 a, b possible between multiple routes) followed by the first line of the S T+1 number, which means that the grass family and is connected to a city followed by the first T+2 line with the D number, which means that the grass to go places. Output ZJB able to go to a favorite city of the shortest time, if can not arrive, output-1.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
019 一个人的旅行.cpp
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.