- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
面试题 - 副本
Problem one: Trains
The local commuter railroad services a number of towns in Kiwiland. Because of monetary concerns, all of the tracks are one-way. That is, a route from Kaitaia to Invercargill does not imply the existence of a route from Invercargill to Kaitaia. In fact, even if both of these routes do happen to exist, they are distinct and are not necessarily the same distance!
The purpose of this problem is to help the railroad provide its customers with information about the routes. In particular, you will compute the distance along a certain route, the number of different routes between two towns, and the shortest route between two towns.
Input: A directed graph where a node represents a town and an edge represents a route between two towns. The weighting of the edge represents the distance between the two towns. A given route will never appear more than once, and for a given route, the starting and ending town will not be the same town.
Output: For test input 1 through 5, if no such route exists, output NO SUCH ROUTE. Otherwise, follow the route as given; do not make any extra stops! For example, the first problem means to start at city A, then travel directly to city B (a distance of 5), then directly to city C (a distance of 4).
The distance of the route A-B-C.
The distance of the route A-D.
The distance of the route A-D-C.
The distance of the route A-E-B-C-D.
The distance of the route A-E-D.//算法1, 用于查表计算
The number of trips starting at C and ending at C with a maximum of 3 stops. In the sample data below, there are two such trips: C-D-C (2 stops). and C-E-B-C (3 stops).
The number of trips starting at A and ending at C with exactly 4 stops. In the sample data below, there are three such trips: A to C (via B,C,D); A to C (via D,C,D); and A to C (via D,E,B).//算法2,只计算边的条数,使用dfs解决
The length of the shortest route (in terms of distance to travel) from A to C. //使用经典的最短路径解决
The length of the shortest route (in terms of distance to travel) from B to B.
number of
您可能关注的文档
- 美国历史Chapter II.ppt
- 2012级英语期末考试(一)A卷.doc
- hobbies新.ppt
- 栈的程序实现作业.ppt
- 数据结构培训ch03 Stack & Queue.ppt
- M-2unit-1open your book课件.ppt
- C5 Summarizing 总结写作.ppt
- 大学英语B (II)期中考试试卷.docx
- 04第4章 栈和队列.ppt
- 马承直呼英语lesson 13.ppt
- 外研社高一英语必修二M2 Module 2 No Drugs单元测试题2.doc
- Ch02Budgetary and Other Constraints on Choice(微观-范里安-(上海交通大学,赵旭 ).ppt
- 广州版牛津英语九年级上U1 Language Body Language.ppt
- such implementation – the.pdf
- 《微观经济学》清华大学课件 Ch2 Budget Constraint.ppt
- B2suchthat B2 ∈ Xand B1 ∈ B2.ThensupXislimitinfiniteordinal.pdf
- 实验四 停车场管理.ppt
最近下载
- 学堂在线 实用绳结技术 期末考试答案.docx VIP
- 风力发电技术的发展现状和未来发展趋势.pptx VIP
- 医疗行业数据脱敏技术方案.docx VIP
- 新译林九年级上Unit 4 精选短语和词汇(预习+复习+默写)2024-2024学年牛津版英语九年级上册.docx VIP
- DB14T 3225-2025煤矸石生态回填环境保护技术规范.docx VIP
- 精品解析:辽宁省沈阳市第四十三中学2024-2025学年八年级上学期期中考试 数学试题(原卷版).docx VIP
- 中医内科学中风(共42张PPT).pptx VIP
- 探究与实践++湖泊生态环境治理与保护+课件-2025-2026学年八年级地理上学期湘教版(2024).pptx VIP
- 医疗器械经营质量管理制度及工作程序.docx VIP
- 额定电压110 kV(Um=126 kV)交联聚乙烯绝缘电力电缆及其附件 第1部分:试验方法和要求.pdf VIP
文档评论(0)