#include<bits/stdc++.h>using namespace std;void dfs(vector<vector<int>> &grid, int r, int c){ // 判断边界是否合适 int row=grid.size(); int col=grid[0].size(); if(!(r>=0&&r<row&&c>=0&&c<col)) return ; //判断这个格子是不是岛屿 if(grid[r][c]!=1) return ; //将格子标记为已经遍历 grid[r][c]=2; //访问上、下、左、右四个相邻结点 dfs(grid,r-1,c); dfs(grid,r+1,c); dfs(grid,r,c-1); dfs(grid,r,c+1);}int main(){ return 0;}