您当前的位置: 首页 >  搜索

*DDL_GzmBlog

暂无认证

  • 3浏览

    0关注

    605博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

[Acwing] 1097 池塘计数 搜索的计数问题

*DDL_GzmBlog 发布时间:2021-06-11 19:37:47 ,浏览量:3

目录
  • BFS:
    • 思路:
    • code:
  • DFS
    • 思路
    • code

BFS: 思路:

对于每一个W 我们都进行广搜和打标记,同时标记能到的地方

code:
#include 
using namespace std;
const int N = 1e3+10;
int dx[]= {0,0,1,-1,1,-1,1,-1};
int dy[]= {1,-1,0,0,1,-1,-1,1};
char g[N][N];
int n,m,cnt,st[N][N] ;
struct node
{
    int x,y;
};
void bfs(int x,int y)
{
    queue q;
    q.push({x,y});
    while(!q.empty())
    {
        node t = q.front();
        q.pop();
        for(int i=0; i            
关注
打赏
1657615554
查看更多评论
0.1080s