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)
{
- 相关阅读:
Android开发_Animation
spring开发_JDBC操作MySQL数据库_使用xml配置事务管理
spring开发_AOP_代理模式
java file 文件操作 operate file of java
spring开发_spring构造注入Bean
spring开发_spring中Bean的作用域_singleton_prototype
spring开发_JDBC操作MySQL数据库
java的jxl技术导入Excel
spring开发_spring环境搭建
魅族m8开发 step by step(1)(让程序跑起来)
- 原文地址:https://www.cnblogs.com/zhchoutai/p/6791710.html
- 最新文章
POJ 3648 Wedding(2SAT)
POJ 2296 Map Labeler(二分+2SAT可行性判断)
ZOJ 3604 Help Me Escape(期望DP)
HDU 4336 Card Collector(概率DP,状态压缩)
POJ 3207 Ikki's Story IV Panda's Trick(2SAT)
HDU 3622 Bomb Game(二分+2SAT)
HDU 4418 Time travel(高斯消元法求解概率DP)
ZOJ 3380 Patchouli's Spell Cards(概率DP)
关于spring2.5的@Scoped
转ogre 渲染流程
Copyright © 2011-2022 走看看