Advertisement

AcWing 1113 红与黑 题解(搜索 BFS)

阅读量:

AcWing 1113. 红与黑
BFS 计算数量,不是难题

复制代码
    #include<bits/stdc++.h>
    
    using namespace std;
    
    const int N = 25;
    
    #define x first
    #define y second
    
    typedef pair<int, int>PII;
    
    char g[N][N];
    bool st[N][N];
    int w, h;
    int a, b; 
    queue<PII>q;
    int dx[4] = {1, -1, 0, 0};
    int dy[4] = {0, 0, 1, -1};
    
    int bfs(int h, int w){
    int res = 1;
    memset(g, 0, sizeof g);
    memset(st, 0, sizeof st);
    for(int i = 0; i < h; i ++ ){
        for(int j = 0; j < w; j ++ ){
            cin>>g

全部评论 (0)

还没有任何评论哟~