【PAT甲级】1072 Gas Station (30 分)(Dijkstra)
题意:
输入四个正整数N,M,K,D(N<=1000,M<=10,K<=10000)分别表示房屋个数,加油站个数,路径条数和加油站最远服务距离,接着输入K行每行包括一条路的两条边和距离。输出最近距离最远同时与所有房屋距离都不超过D的加油站名字和最近距离以及平均距离。如果有多个答案则优先输出平均距离最小的,再不唯一则输出编号最小的。
trick:
这题有一个诡异的事情,样例1的平均距离是3.25,取一位小数应该是3.2,四舍五入则是3.3,样例显示为3.3,此时我理解为四舍五入,题面说是精确到1位小数。
当我将ans+0.05时测试点4会不过,当我直接舍入时AC样例却输出3.2。
【PAT甲级】1072 Gas Station (30 分)(Dijkstra)的更多相关文章
- PAT 甲级 1072 Gas Station (30 分)(dijstra)
1072 Gas Station (30 分) A gas station has to be built at such a location that the minimum distance ...
- pat 甲级 1072. Gas Station (30)
1072. Gas Station (30) 时间限制 200 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue A gas sta ...
- PAT Advanced 1072 Gas Station (30) [Dijkstra算法]
题目 A gas station has to be built at such a location that the minimum distance between the station an ...
- PAT甲级——1072 Gas Station
A gas station has to be built at such a location that the minimum distance between the station and a ...
- 1072. Gas Station (30)【最短路dijkstra】——PAT (Advanced Level) Practise
题目信息 1072. Gas Station (30) 时间限制200 ms 内存限制65536 kB 代码长度限制16000 B A gas station has to be built at s ...
- PAT 1072. Gas Station (30)
A gas station has to be built at such a location that the minimum distance between the station and a ...
- 1072 Gas Station (30)(30 分)
A gas station has to be built at such a location that the minimum distance between the station and a ...
- 1072. Gas Station (30)
先要求出各个加油站 最短的 与任意一房屋之间的 距离D,再在这些加油站中选出最长的D的加油站 ,该加油站 为 最优选项 (坑爹啊!).如果相同D相同 则 选离各个房屋平均距离小的,如果还是 相同,则 ...
- PAT 甲级 1030 Travel Plan (30 分)(dijstra,较简单,但要注意是从0到n-1)
1030 Travel Plan (30 分) A traveler's map gives the distances between cities along the highways, to ...
随机推荐
- [Codechef - ADITREE] Adi and the Tree - 树链剖分,线段树
[Codechef - ADITREE] Adi and the Tree Description 树上每个节点有一个灯泡,开始所有灯泡都是熄灭的.每次操作给定两个数 \(a,b\) ,将 \(a,b ...
- StreamPipes
MQTT is a machine-to-machine (M2M)/"Internet of Things" connectivity protocol. It was desi ...
- js学习(精华帖)
js获取当前域名.Url.相对路径和参数以及指定参数 js获取当前url组成部分 jquery操作select(增加,删除,清空)
- c++11 lambda简录
本文为转载,详情请观看原文连接 或许,Lambda 表达式算得上是 C++ 11 新增特性中最激动人心的一个.这个全新的特性听起来很深奥,但却是很多其他语言早已提供(比如 C#)或者即将提供(比如 J ...
- Web设计精髓(转)
作者:zhouwenqi 地址:http://www.zhouwenqi.com/blog/board_43.html 这篇文章说实际问题的,所以不多强调,下面是我总结的一些比较突出的细节问题,而且 ...
- HTML 5的革新——语义化标签(一)
HTML 5的革新之一:语义化标签一节元素标签. 在HTML 5出来之前,我们用div来表示页面章节,但是这些div都没有实际意义.(即使我们用css样式的id和class形容这块内容的意义).这些标 ...
- Java接收前台传回的json
var list = new Array(); var obj = {}; obj.name= "zhangsan"; obj.sex= "女";obj.ema ...
- JavaScript——BOM和DOM
什么是BOM bom:浏览器对象模型 什么是DOM dom:文档对象模型 BOM操作: 调用windows浏览器窗口 windows对象可以通过点调用子对象 windows.navigator对象,可 ...
- ASP.NET + MVC5 入门完整教程七 -—-- MVC基本工具(上)
https://blog.csdn.net/qq_21419015/article/details/80474956 这里主要介绍三类工具之一的 依赖项注入(DI)容器,其他两类 单元测试框架和模仿工 ...
- windows10桌面突然变灰了
不靠谱的第三方软件重装系统,装了以后系统有点问题,会隔一段时间变灰 了 windows+ctrl+c 直接就恢复色彩了