HDU 4414 Finding crosses (DFS + BFS)
摘要:
题意:在N*N的图中,找出孤立存在的十字架的个数。十字架要求为正十字,孤立表示组成十字架的‘#的周围的一格再无’#‘。dfs找出在中心的‘#’(周围四格也为‘#'),则缩小了搜索范围,再bfs找出是否是符合要求。#include #include #include #include #include using namespace std;char map[55][55];int n,cnt,head,tail,vis[55][55],center[55][55];int dirx[4] = {1,-1,0,0};int diry[4] = {0,0,1,-1};struct Queu 阅读全文