Einbahnstra e (一条单行道德语) 是一条街道上的车辆应只有一个方向移动。具有单向街道的一个原因是交通的便于通过拥挤地区更为畅顺。在城市中心,特别是老城市像开罗和大马士革,这非常有用。仔细规划保证能让你上从任何位置开始的任何位置。不过,司机必须仔细规划他们的路线以避免延长旅行由于单行道。经验丰富的司机知道有多个路径以任何两个地点之间旅行。不仅如此,可能会有多个道路在相同的两个地点之间。知道任何两个位置之间的最短途径是必须的!这是更重要的驾驶车辆很难机动 (垃圾卡车,牵引卡车等)。你刚开始一份新的工作在牵引车的公司。公司拥有一批牵引卡车停在公司车库。一辆拖车升降机前面或以将它拉直的破车后轮回公司的车库。你接听来自世界各地的城市大约需要被拖的破车。这些汽车有拖相同的顺序,因为你接听电话。你的工作是,劝谕拖车司机最短的路,以便收集关于所有损坏的汽车回公司的车库。在年底的一天,你必须向总距离乘卡车的管理报告。InputYour program will be tested on one or more test cases. The first line of each test case specifies three numbers (N , C , and R ) separated by one or more spaces. The city has N locations with distinct names, including the company's garage. C is the number of broken cars. R is the number of roads in the city. Note that 0 < N < 100 , 0<=C < 1000 , and R < 10000 . The second line is made of C + 1 words, the first being the location of the company's garage, and the rest being the locations of the broken cars. A location is a word made of 10 letters or less. Letter case is significant. After the second line, there will be exactly R lines, each describing a road. A road is described using one of these three formats:A -v -> BA <-v - BA <-v -> BA and B are names of two different locations, while v is a positive integer (not exceeding 1000) denoting the length of the road. The first format specifies a one-way street from location A to B , the second specifies a one-way street from B to A , while the last specifies a two-way street between them. A , ``the arrow", and B are separated by one or more spaces. The end of the test cases is specified with a line having three zeros (for N , C , and R .)The test case in the example below is the same as the one in the figure. OutputFor each test case, print the total distance traveled using the following format:k . VK 在哪里测试事例编号 (从 1 开始),是一个空间,和 V 是结果。
正在翻譯中..
