编程介的小学生 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
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 python代码,帮调试
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条