编程介的小学生 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 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序