题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4414

  直接暴力判断即可。

 //STATUS:C++_AC_15MS_232KB
#include <functional>
#include <algorithm>
#include <iostream>
//#include <ext/rope>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <cstring>
#include <cassert>
#include <cstdio>
#include <string>
#include <vector>
#include <bitset>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <list>
#include <set>
#include <map>
using namespace std;
//using namespace __gnu_cxx;
//define
#define pii pair<int,int>
#define mem(a,b) memset(a,b,sizeof(a))
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define PI acos(-1.0)
//typedef
typedef __int64 LL;
typedef unsigned __int64 ULL;
//const
const int N=;
const int INF=0x3f3f3f3f;
const int MOD=,STA=;
const LL LNF=1LL<<;
const double EPS=1e-;
const double OO=1e15;
const int dx[]={-,,,};
const int dy[]={,,,-};
const int day[]={,,,,,,,,,,,,};
//Daily Use ...
inline int sign(double x){return (x>EPS)-(x<-EPS);}
template<class T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<class T> T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T> inline T lcm(T a,T b,T d){return a/d*b;}
template<class T> inline T Min(T a,T b){return a<b?a:b;}
template<class T> inline T Max(T a,T b){return a>b?a:b;}
template<class T> inline T Min(T a,T b,T c){return min(min(a, b),c);}
template<class T> inline T Max(T a,T b,T c){return max(max(a, b),c);}
template<class T> inline T Min(T a,T b,T c,T d){return min(min(a, b),min(c,d));}
template<class T> inline T Max(T a,T b,T c,T d){return max(max(a, b),max(c,d));}
//End char ma[N][N];
int n; int isok(int x,int y)
{
int i,j,l,r,cnth;
for(l=;y-l>= && ma[x][y-l]=='#';l++){
if(ma[x-][y-l]=='#' || ma[x+][y-l]=='#')return ;
}
for(r=;y+r<n && ma[x][y+r]=='#';r++){
if(ma[x-][y+r]=='#' || ma[x+][y+r]=='#')return ;
}
if(l!=r || l== || r==)return ;
cnth=l;
for(l=;x-l>= && ma[x-l][y]=='#';l++){
if(ma[x-l][y-]=='#' || ma[x-l][y+]=='#')return ;
}
for(r=;x+r<n && ma[x+r][y]=='#';r++){
if(ma[x+r][y-]=='#' || ma[x+r][y+]=='#')return ;
}
if(l!=r || l== || r==)return ;
if(cnth!=l)return ;
return ;
} int main()
{
// freopen("in.txt","r",stdin);
int i,j,cnt;
while(~scanf("%d",&n) && n)
{
for(i=;i<n;i++){
scanf("%s",ma[i]);
}
cnt=;
for(i=;i<n-;i++){
for(j=;j<n-;j++){
if(ma[i][j]=='#')cnt+=isok(i,j);
}
} printf("%d\n",cnt);
}
return ;
}

HDU-4414 Finding crosses 水题的更多相关文章

  1. hdu 4414 Finding crosses【简单模拟】

    题目:http://acm.hdu.edu.cn/showproblem.php?pid=4414 CSUST:点击打开链接 Finding crosses Time Limit: 2000/1000 ...

  2. hdu 4414 Finding crosses

    题目链接:hdu 4414 其实是一道简单的字符型水题,不涉及任何算法,可比赛时却没能做出来,这几天的状态都差到家了... 题目大意是求有多少个满足条件的十字架,十字架的边不能有分叉路口,所以枚举每个 ...

  3. HDU 4414 Finding crosses(dfs)

    Problem Description The Nazca Lines are a series of ancient geoglyphs located in the Nazca Desert in ...

  4. HDU 4414 Finding crosses (DFS + BFS)

    题意:在N*N的图中,找出孤立存在的十字架的个数.十字架要求为正十字,孤立表示组成十字架的‘#的周围的一格再无’#‘. dfs找出在中心的‘#’(周围四格也为‘#'),则缩小了搜索范围,再bfs找出是 ...

  5. hdu 1106:排序(水题,字符串处理 + 排序)

    排序 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submissi ...

  6. HDU 4950 Monster (水题)

    Monster 题目链接: http://acm.hust.edu.cn/vjudge/contest/123554#problem/I Description Teacher Mai has a k ...

  7. HDU 4813 Hard Code 水题

    Hard Code Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.act ...

  8. HDU 4593 H - Robot 水题

    H - RobotTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.act ...

  9. HDOJ/HDU 2560 Buildings(嗯~水题)

    Problem Description We divide the HZNU Campus into N*M grids. As you can see from the picture below, ...

随机推荐

  1. STL容器的本质

    http://blog.sina.com.cn/s/blog_4d3a41f40100eof0.html 最近在学习unordered_map里面的散列函数和相等函数怎么写.学习过程中看到了一个好帖子 ...

  2. unity3d 使用背景贴图

    使用贴图代替天空盒作为背景,参照:http://www.narkii.com/club/thread-261840-1.html 看看我做的:

  3. Amazon Alexa 语音识别2 : 设置

    开发者建立的Skill的主要设置项目都在Skill的console内.需要填写的东西大致有以下几个: 1.Skill 名字.这个名字是用户用来唤醒你这个Skill的. 2.Intent Schema: ...

  4. ubuntu下安装ssh

    vm安装ubunt后,无法连接ssh,一般情况是防火墙的问题,或者SSH没有安装. 防火墙 1.查看防火墙 sudo ufw status 2,关闭防火墙 sudo ufw disable ssh 1 ...

  5. Servlet实现文件上传

    一.Servlet实现文件上传,需要添加第三方提供的jar包 下载地址: 1) commons-fileupload-1.2.2-bin.zip      :   点击打开链接 2) commons- ...

  6. 递归解析XML

    package com.app.test; import java.io.InputStream; import java.util.List; import org.dom4j.Attribute; ...

  7. 从Clarifai的估值聊聊深度学习

    从Clarifai的估值聊聊深度学习 [转载请注明出处] 前几天和 Ayden @叶瀚中 聊天时,提到了 www.clarifai.com 这家公司. 此前,我已经从各方消息中听说过创始人Matt Z ...

  8. 服务器部署_centos 安装jdk手记

    1. 下载jdk略. 2. 将jdk相关文件目录放到指定目录 (1) 创建jdk目录 /usr/java/jdk7 mkdir -p /usr/java/jdk7 (2) 解压缩jdk压缩包,并移动至 ...

  9. MongoDB实战指南(三):MongoDB的锁机制

    与关系数据库一样,MongoDB也是通过锁机制来保证数据的完整性和一致性,MongoDB利用读写锁来支持并发操作,读锁可以共享写锁具有排他性.当一个读锁存在时,其他读操作也可以用这个读锁:但当一个写锁 ...

  10. ZOJ - 3195 Design the city

    题目要对每次询问将一个树形图的三个点连接,输出最短距离. 利用tarjan离线算法,算出每次询问的任意两个点的最短公共祖先,并在dfs过程中求出离根的距离.把每次询问的三个点两两求出最短距离,这样最终 ...