山东省第七届ACM省赛------The Binding of Isaac
The Binding of Isaac
Time Limit: 2000MS Memory limit: 65536K
题目描述

Ok, now I will introduce this game to you...
Isaac is trapped in a maze which has many common rooms…
Like this…There are 9 common rooms on the map.

And there is only one super-secret room. We can’t see it on the map. The super-secret room always has many special items in it. Isaac wants to find it but he doesn’t know where it is.Bob
tells him that the super-secret room is located in an empty place which is adjacent to only one common rooms.
Two rooms are called adjacent only if they share an edge. But there will be many possible places.

Now Isaac wants you to help him to find how many places may be the super-secret room.
输入
Multiple test cases. The first line contains an integer T (T<=3000), indicating the number of test case.
Each test case begins with a line containing two integers N and M (N<=100, M<=100) indicating the number
of rows and columns. N lines follow, “#” represent a common room. “.” represent an empty place.Common rooms
maybe not connect. Don’t worry, Isaac can teleport.
输出
One line per case. The number of places which may be the super-secret room.
示例输入
2 5 3 ..# .## ##. .## ##. 1 1 #
示例输出
8 4
来源
题意
#include"stdio.h"
#include"string.h"
#include<iostream>
using namespace std;
char a[105][105];
int main()
{
int n;
cin>>n;
while(n--)
{
int c,b;
cin>>c>>b;
getchar();
memset(a,0,sizeof(a));
for(int i=1; i<=c; i++)
gets(a[i]+1);
int s=0;
for(int i=0; i<=c+1; i++)
for(int j=0; j<=b+1; j++)
if(a[i][j]!='#')
{
int d=0;
if(i>0&&a[i-1][j]=='#')d++;
if(a[i+1][j]=='#')d++;
if(j>0&&a[i][j-1]=='#')d++;
if(a[i][j+1]=='#')d++;
if(d==1)s++;
}
printf("%d\n",s);
}
return 0;
}
山东省第七届ACM省赛------The Binding of Isaac的更多相关文章
- 山东省第七届ACM省赛------Memory Leak
Memory Leak Time Limit: 2000MS Memory limit: 131072K 题目描述 Memory Leak is a well-known kind of bug in ...
- 山东省第七届ACM省赛------Reversed Words
Reversed Words Time Limit: 2000MS Memory limit: 131072K 题目描述 Some aliens are learning English. They ...
- 山东省第七届ACM省赛------Triple Nim
Triple Nim Time Limit: 2000MS Memory limit: 65536K 题目描述 Alice and Bob are always playing all kinds o ...
- 山东省第七届ACM省赛------Fibonacci
Fibonacci Time Limit: 2000MS Memory limit: 131072K 题目描述 Fibonacci numbers are well-known as follow: ...
- 山东省第七届ACM省赛------Julyed
Julyed Time Limit: 2000MS Memory limit: 65536K 题目描述 Julyed is preparing for her CET-6. She has N wor ...
- 山东省第七届ACM省赛
ID Title Hint A Julyed 无 B Fibonacci 打表 C Proxy 最短路径 D Swiss-system tournament 归并排序 E The Binding of ...
- 山东省第十届ACM省赛参赛后的学期总结
5.11,5.12两天的济南之旅结束了,我也参加了人生中第一次正式的acm比赛,虽然是以友情队的身份,但是我依旧十分兴奋. 其实一直想写博客来增加自己的能力的,但是一直拖到现在,正赶上老师要求写一份总 ...
- Rectangles(第七届ACM省赛原题+最长上升子序列)
题目链接: http://acm.nyist.edu.cn/JudgeOnline/problem.php?pid=1255 描述 Given N (4 <= N <= 100) rec ...
- 山东理工大学第七届ACM校赛-LCM的个数 分类: 比赛 2015-06-26 10:37 18人阅读 评论(0) 收藏
LCM的个数 Time Limit: 1000ms Memory limit: 65536K 有疑问?点这里^_^ 题目描述 对于我们来说求两个数的LCM(最小公倍数)是很容易的事,现在我遇到了 ...
随机推荐
- Unity5和WebGL移植指南的一些总结
对于手游开发者来说,更新版本往往意味着非常复杂的过程,你需要根据反馈做更新.测试.提交然后等待审核,而由于不需要客户端依赖,页游往往是快速测试游戏版本的最佳途径,很多人可能都知道Unity 5可以再不 ...
- [转载]ERP实施40问 60分钟外行变专家
http://www.chinaodoo.net/thread-389-1-1.html 在多年的实践中,结合自身经验和多年的理论积累,总结出有关ERP实施的最关键的40个问题,以问答的形式,让您在最 ...
- centos7 mariadb
闲置已久的空间环境配置忘得差不多了,今天得空整理,重置了磁盘重新搭建环境,首先在CentOS 7.0安装MariaDB的数据库,在这里记录下安装过程,以便以后查看. 1.安装MariaDB 安装命令 ...
- django--主要部分
django URL URL配置(URLconf)就像Django 所支撑网站的目录.它的本质是URL模式以及要为该URL模式调用的视图函数之间的映射表:你就是以这种方式告诉Django,对于这个U ...
- java 给指定时间加上天数or给当前日期加天数
给指定日期加上天数: /** * 指定日期加上天数后的日期 * @param num 为增加的天数 * @param newDate 创建时间 * @return * @throws ParseExc ...
- [原创]在Framelayout中放置button控件出现的覆盖问题
android Framelayout(帧布局)是很常用的布局,主要用来处理需要多个view叠加显示的情况. 然而在使用中,我发现Framelayout中的Button控件,会挡住所有其他控件,而不论 ...
- Python之路----------random模块
随机数模块: import random #随机小数 print(random.random()) #随机整数 print(random.randint(1,5))#他会打印5 #随机整数 print ...
- Leetcode: Encode String with Shortest Length && G面经
Given a non-empty string, encode the string such that its encoded length is the shortest. The encodi ...
- 找出数组中从未出现的最小正整数java实现
/** * 找出未出现的最小正整数 * @param A * @param n * @date 2016-10-7 * @author shaobn */ public static int find ...
- JAVA基本类库介绍
我们曾经讲过,Java已经为编程者编制了许多类,这些类已经经过测试,基本上不存在错误,这些类都是我们编程的基础.如果不利用这些已存在的类,我们的 编程工作将变得异常复杂,所以我们应尽可能多的掌握Jav ...