编程介的小学生 2017-10-28 07:42 采纳率: 20.5%
浏览 890
已采纳

XM Reserves

Problem Description
As an eligible Ingress Resistance Agent you should know your power source, the Exotic Matter.
We call it XM, which is the driving force behind all of our actions in Ingress.
XM allows us to construct items through hacking portals, to attack enemy portals, make links and create fields.

We try to collect XM from the ground. XM concentration come from location based services, meaning that areas with a lot of foot traffic have higher amounts versus places that don't.
You can collect XM by moving through those areas.
The XM will be automatically harvested by your Scanner when it is within your interaction circle/range.

Alice decides to select a location such that she can collect XM as much as possible.
To simplify the problem, we consider the city as a grid map with size `n*m' numbered from (0,0) to (n−1,m−1).
The XM concentration inside the block (i,j) is p(i,j).
The radius of your interaction circle is r.
We can assume that XM of the block (i,j) are located in the centre of this block.
The distance between two blocks is the Euclidean distance between their centres.

Alice stands in the centre of one block and collects the XM.
For each block with the distance d smaller than r to Alice, and whose XM concertation is p(i,j), Alice's scanner can collects p(i,j)/(1+d) XM from it.

Help Alice to determine the maximum XM which she can collect once he stands in the centre of one block.

Input
There are multiple cases.
For each case, the first line consists two integers n,m (1≤n,m≤500) and one float-point number r (0≤r≤300).
Each of the following n line consists m non-negative float-point numbers corresponding to the XM concentrations inside each blocks.

Output
For each case, output the maximum XM which Alice can collect in one line.
Your answers should be rounded to three decimal places.

Sample Input
3 3 1
1 3 6
7 9 4
2 8 1
3 3 2
1 3 6
7 9 4
2 8 1
5 5 1.5
4 3 2 9 1
3 4 3 2 8
9 4 3 2 1
2 3 0 1 2
6 3 4 3 1

Sample Output
9.000
24.142
17.956

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-11-17 02:03
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能