放积木

Description

现有一个n*m的矩阵方格和1*2、2*1两种积木。

矩阵中有些格子是不能放积木的,摆放的积木是不能互相重合的。当然。积木也不能放到矩阵外面。问。这个矩阵,最多能放多少积木?

Input

多组输入。每组第一行有两个整数n、m,表示矩阵有n行。m列。(1<=n,m<=10)
接下来,会有n行字符串。每行有m个字符。

字符仅仅会是‘.’ 或‘*’, ‘*’表示这个格子不能放积木。‘.’表示这个格子能够放积木。

Output

每组输出一行。这行包括一个数字。表示这个矩阵最多放的积木数量。

Sample Input

5 2
.*
..
.*
..
*.

Sample Output

3
 
   
代码例如以下:
 
   
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <string>
#define OUT(x) cout << #x << ": " << (x) << endl
using namespace std;
const int mmax=200;
const int inf=0x3fffffff;
bool G[mmax][mmax];
char tt[mmax][mmax];
int dir[4][2]={{0,1},{0,-1},{1,0},{-1,0}};
bool vis[mmax];
int link[mmax];
int n,m;
bool find( int x)
{
    
posted @ 2017-05-01 13:00  zhchoutai 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/zhchoutai/p/6791710.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值