作业帮 > 英语 > 作业

英语翻译Input must be read with scanf().The input will contain o

来源:学生作业帮 编辑:搜狗做题网作业帮 分类:英语作业 时间:2024/06/17 05:28:18
英语翻译
Input must be read with scanf().The input will contain only what is described here.
The input will start with a line containing one integer specifying the number of vertices.This will
be followed by the data specifying the outgoing edges from each vertex,(first the data about the
outgoing edges from vertex 0,then the data about the outgoing edges from vertex 1,etc.).The data
for each vertex will consist of a line containing an integer specifying the number of outgoing edges,
followed by a series of lines,one for each outgoing edge from the vertex,each such line containing
an integer specifying the vertex to which the edge goes,a space,and an integer specifying the
weight of the edge.The outgoing edges of a vertex will be in ascending order of "to" vertex.The
last line of the input will be an integer specifying the vertex from which the search must start.
(The input1 file in the assignment2 directory specifies a problem using the graph from the relevant
weekly work,replacing vertex label a by 0,vertex label b by 1,etc.)
The output must be produced with printf().The output must contain only what is described here.
The output must be (only) the lengths of the shortest path distances,(starting with the distance 0 for
the start vertex) in non-descending order of shortest path distance,each as would be produced by:
printf("%d\n",distance[i]);
where distance[i] is the relevant distance.
(The output1 file is the output file for input1.)
以下是输入要求 我只知道第一行7 说的是有7个节点(The input will start with a line containing one integer specifying the number of vertices.求教
7
1
2 3
2
0 5
3 3
0
1
2 8
2
1 9
3 7
2
0 9
1 2
2
4 5
5 8
6
英语翻译Input must be read with scanf().The input will contain o
不翻译了,我就按样例解释下吧.
7 顶点的数量
1 顶点的0 的出度数
2 3 与顶点0相连顶点2 权为3
2 顶点的1 的出度数
0 5 与顶点1相连顶点0 权为5
3 3 与顶点1相连顶点3 权为3
0 顶点的2 的出度数 后面类推.
1
2 8
6 最后一行一个数 查找的起始点
输入必须用scanf()函数读取 输入内容描述如下:
输入以一个指定的顶点数量整数占据一行开始 , 接下来的数据将指明每个顶点的流出边(从0开始递加) 每个顶点的这组数据的第一行是流出边的数量,接下来有相应的行数,每行有两个整数分别表示另一个顶点和该流出边的权值,中间用一个空格隔开.另外那另一顶点也是升序出现.
最后一行是查找开始的顶点.
(在任务2目录中的input1输入文件中指定了问题使用的来自与每周工作相关的图,将其中的a用0替换,b用1替换,以此类推.)
输出必须用printf程序,输出内容描述如下:
输出必须是最短路径长度以升序的方式(对于起始点的长度用0)例如程序可用printf( “%d\n”,distance[i] ) ; distance[i]是相关点的最短路径长(output1 文件是input1 的输出)