Accept: 225Submit: 485
Time Limit: 1000 mSecMemory Limit : 32768 KB
Problem Description
Yangtse Rive Barge Club has set up n barge hiring stops numbered 1, 2, … , n along the Changjiang River. Passengers can hire barges from any of these stops, and return the barges to one of the stops afterward. The rent for an barge from stop i to stop j is r(i,j) (1<=i,j<=n). Your task is to design an algorithm to minimize the rent of hiring barges when you traveling from stop 1 to stop n.
Input
There are multiple test cases. The first line of each case contains an integer n indicating the number of the stops (n<=200). The following n-1 lines are the rent between any two stops. The ith following line contains n-i integers indicating r(i,j) (i < j <= n).
Output
For each case, output one line representing the minimal rent.
Sample Input
3
5 15
7
Sample Output
12
思路:
题目的意思就是求从停泊点1到n的最少费用
就是求单点源最短路径的问题, 用dijkstra算法
如果存在<Vi,Vj>则map[Vi][Vj]=权值(这里就是vi->vj的费用)
如果不存在初始化为INF(无穷大)
dist[i]数组用来存放源点1到点i的最少费用,
s[i]用来标记源点1到点i的最少费用是否算出
分享到:
相关推荐
这个是讲解的小程序VR全景图,是源码
Credit Token Based Dynamic Resource Renting and Offering Mechanism for Cognitive Radio WRAN BS Spectrum Sharing
hangzhou-renting 租房信息发布,发布转租房图片,说明信息,专为程序猿准备。 需要发布信息请pr.
renting_room租房项目
renting-tool 为租房准备的小程序
将本地存储库添加为来源git remote add origin < your> 将此存储库添加为上游git remote add upstream https://github.com/RentingSystemSE/Renting-System-Backend.git 将本地存储库与中央存储库同步git pull ...
房屋租赁申请链接到部署在heroku上的应用程序: ://house-renting-application.herokuapp.com/
SSM租用系统SSM实现的简单租房系统
房屋出租项目设置npm install编译和热重装以进行开发npm run serve编译并最小化生产npm run build自定义配置请参阅。
To handle all the Video Renting aspects e.g. video renting, buying and waiting lists. New features and enhancements as in (4/7/2005): - 1. Start-up Splash screen that dynamically changes whenever you ...
图书租借: 使用django的图书租赁应用程序 db:sqlite django版本:1.5 python版本:2.7 使用ajax搜索书籍
租用电脑 项目设置 npm install 编译和热重装以进行开发 npm run serve 编译并最小化生产 npm run build 整理和修复文件 npm run lint 自定义配置 请参阅。
由团队创建的用生成的Rails应用。
马德里房屋的数据科学租金估算器:端到端项目创建了一个估算马德里房屋租金价格的工具,该工具可以帮助单位所有者以及正在寻找房屋的人了解马德里的Real State Market。概括: 使用python和beautifulsoup库从刮取了...
思想来源于Renting Liu.REDUCING BOUNDARY ARTIFACTS IN IMAGE DECONVOLUTION
analyse_renting_info.py使用从数据库中读取出爬取的租房信息的地址,通过调用高德地址编码API转换为经纬度,替换转换错误以及地址本身有问题的数据,最后将有效的经纬度更新到内部的数据集合中,同时同时将过程中...
房地产开发商公司网站模板,全套模板,DIV CSS布局,包含buying.html,contacts.html,finance.html,index.html,renting.html,selling.html等多个页面网站模板。
包含了Java课程设计的所有代码和所需要的图片,只需下载...使用数据库为MySQL,数据库连接层renting.dal包中的DBConnecter.java,使用时需要改变数据库连接的用户名和密码,运行效果图和总体设计在我的博客中可以找到。
Rental Calc helps real estate investors determine if a potential property is worth buying and renting. Create a property entry, enter a few fields, and Rental Calc will compute what you need at ...
这篇文章主要介绍了Python ... with open(renting.csv,'r',encoding = 'utf_8_sig') as f: f_csv = csv.reader(f) for row in f_csv: print(row) def Test1(): headers = ['ID','NAME','Age','Height'] #表格内容