题目链接: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. JAVA 内存管理总结

    1. java是如何管理内存的 Java的内存管理就是对象的分配和释放问题.(两部分) 分配 :内存的分配是由程序完成的,程序员需要通过关键字new 为每个对象申请内存空间 (基本类型除外),所有的对 ...

  2. chrome extension/plugin path

    C:\Users\Administrator\AppData\Local\Google\Chrome\User Data\Default\Extensions

  3. MVC5 ModelBinder

    MVC5 ModelBinder 什么是ModelBinding ASP.NET MVC中,所有的请求最终都会到达某个Controller中的某个Action并由该Action负责具体的处理和响应.为 ...

  4. windows store app 拷贝文件到pc目录

    (function () { "use strict"; WinJS.Binding.optimizeBindingReferences = true; var app = Win ...

  5. 《JavaScript启示录》摘抄

    1.JavaScript预包装的9个原生的对象构造函数: Number(),String(),Boolean(),Object(),Array(),Function(),Data(),RegExp() ...

  6. google 开放I/O源码

    在这款应用程序中谷歌对部分功能.API和设计架构进行了非常详细的阐述,其中包括碎片.程序加载.服务.广播.接收器.警告.通知.SQLite数据库.内容提供商.Action Bar.导航Drawer和G ...

  7. Java Portlet 规范概述

    首先,解释几个基本的术语. 1)Portal Portal 是一种 web 应用,通常具有个性化.单点登录.来自不同源的内容聚合(aggregation)并提供信息系统表现层等特点.所谓聚合,是指将不 ...

  8. CentOS查看CPU信息、位数、多核信息

    # uname -a Linux localhost.localdomain 2.6.18-164.el5PAE #1 SMP Thu Sep 3 04:10:44 EDT 2009 i686 i68 ...

  9. 《ArcGIS Engine+C#实例开发教程》第八讲 属性数据表的查询显示

    原文:<ArcGIS Engine+C#实例开发教程>第八讲 属性数据表的查询显示 第一讲 桌面GIS应用程序框架的建立 第二讲 菜单的添加及其实现 第三讲 MapControl与Page ...

  10. 169. Majority Element

    题目: Given an array of size n, find the majority element. The majority element is the element that ap ...