编程介的小学生 2017-08-27 13:37 采纳率: 20.5%
浏览 685
已采纳

Starfruit

Plants VS Zombie is an interesting game, recently Edward has become totally addicted to playing this game. There are many kinds of plants he can choose to defend zombies, but what Edward interests most is a kind of plants called Starfruit. As we know, most plants stand toward right and only can attack zombies those are precisely on its right. However, starfruit is much more powerful, it can sparks little stars towards five directions!

Edward is so interested in this fruit that he wrote a game with nothing but starfruit. Unfortunately, something beyond exception happened, that starfruit now only can attack less than 3 units distance(by Euclidean distance), also he made a mistake with directions: now starfruits spark towards up, left, right, lower left and lower right(not as usual in PVZ). What's more, now starfruit attacks each other!

As Edward likes statfruit very much, he wants to put as more starfruit into the map as possible, but if you place a starfruit on a lattice attacked by another starfruit, it will die and disappear immediately. So now he wants to know the maximum number of starfruits can be placed on the map, but recently he's busy preparing Summer Camp so he turns to your help.

Input

The input consists of several cases. Each case starts with a line contains two integer n(1≤n≤1000) and m(1≤m≤12), indicates that it's a map of width m and height n. Then follows n lines each with m characters, which is either 'X' or '.'. A '.' means you can put starfruit on it, A 'X' means there is a rock there so that you can't put anything on it, also the stars sparked by starfruits can't across a rock.
Input ends when both n and m equals to 0. This case will not be executed.

Output

For each case, output the maximum number of the starfruit you can put.

Sample Input

3 3
...
XX.
...
0 0
Sample Output

3

  • 写回答

1条回答 默认 最新

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

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog