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) << endlusingnamespacestd;constintmmax=200;constintinf=0x3fffffff;boolG[mmax][mmax];chartt[mmax][mmax];intdir[4][2]={{0,1},{0,-1},{1,0},{-1,0}};boolvis[mmax];intlink[mmax];intn,m;boolfind(intx){- 相关阅读:
移动端前端开发调试
webkit图片滤镜
ruby安装sass报错解决办法
mongodb的查询语句学习摘要
signedCookies
[cookie篇]从cookie-parser中间件说起
node.js下mongoose简单操作实例
在ExpressJS中设置二级域名跨域共享Cookie
Node.js开发工具、开发包、框架等总结
hibernate框架学习笔记4:主键生成策略、对象状态
- 原文地址:https://www.cnblogs.com/zhchoutai/p/6791710.html
Copyright © 2011-2022 走看看