1467 - 電機系 (呂老師) DS 上機考4 Scoreboard

Time

2018/05/21 18:35:00 2018/05/21 20:35:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
11936 (電機班上機考) The Cost of Shortest Paths

11936 - (電機班上機考) The Cost of Shortest Paths   

Description

Given
  • Number of matrix
  • A matrix of digits
Task
  • Convert the nonzero digits of the matrix into a graph
    • The nonzero digits represent the weights of edges between two nodes
  • Print out the cost of shortest path of each pair of nodes

Input

Matrix Specification

  • Each cell in the matrix contains a digit value (ranged from 0 to 9)
    • 0 represents no edge between two nodes
    • Nonzero digits represents the weights of two node
  • Take the following figure as an example

Output

  • Print out the cost for each pair in row major order.
  • Print a new line between matrices.

Sample Input  Download

Sample Output  Download

Tags




Discuss