![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
dfs
爱打酱油的剑姬
这个作者很懒,什么都没留下…
展开
-
扫雷(dfs)
#include "bits/stdc++.h" using namespace std; int dir[8][2]={{0,1},{1,0},{0,-1},{-1,0},{1,1},{-1,-1},{1,-1},{-1,1}}; char s[55][55]; int n,m,a,b; int check(int x,int y){ int cnt = 0; for(int i=0;i<8;i++){ int tx = dir[i][0] + x; .原创 2022-01-01 23:24:43 · 524 阅读 · 0 评论 -
被包围的区域(dfs)
#include "bits/stdc++.h" using namespace std; char s[105][105]; int n,m; void dfs(int x,int y){ if(x<1 || y<1 || x > n || y > m || s[x][y] != 'O'){ return; } s[x][y] = 'A'; dfs(x+1,y); dfs(x-1,y); dfs(x,y+1); .原创 2022-01-01 20:41:31 · 169 阅读 · 0 评论 -
图像渲染(dfs)
#include "bits/stdc++.h" using namespace std; int n,m,x,y,a; int s[1005][1005]; int dir[4][2]={{0,1},{1,0},{0,-1},{-1,0}}; void dfs(int xx, int yy, int color, int num){ if(s[xx][yy] != num) return; s[xx][yy] = color; for(int i=0 ; i < 4 ; .原创 2022-01-01 20:40:31 · 147 阅读 · 0 评论 -
沈老师的岛(dfs)
#include "bits/stdc++.h" using namespace std; int n,m; char s[105][105]; int dir[8][2]={{0,1},{1,0},{0,-1},{-1,0},{1,1},{1,-1},{-1,-1},{-1,1}}; void dfs(int x,int y){ s[x][y]='*'; for(int i=0;i<8;i++){ int tx = x + dir[i][0]; i.原创 2022-01-01 20:39:09 · 53 阅读 · 0 评论 -
数独游戏dfs
#include "bits/stdc++.h" using namespace std; char mp[15][15]; bool check(int x,int y,char k){ for(int i=0;i<9;i++){ if(mp[x][i]==k){ return false; } } for(int i=0;i<9;i++){ if(mp[i][y]==k){ .原创 2021-12-16 13:48:30 · 2226 阅读 · 0 评论