标签:|| dfs new ret etc class fill pre color
void dfs(int** image, int imageSize, int colsize, int r, int c, int newColor, int initColor){ if(r<0 || r>=imageSize || c<0 || c>=colsize || image[r][c]!=initColor || image[r][c]==newColor) return; image[r][c]=newColor; dfs(image,imageSize,colsize,r-1,c,newColor,initColor); dfs(image,imageSize,colsize,r+1,c,newColor,initColor); dfs(image,imageSize,colsize,r,c-1,newColor,initColor); dfs(image,imageSize,colsize,r,c+1,newColor,initColor); } int** floodFill(int** image, int imageSize, int* imageColSize, int sr, int sc, int newColor, int* returnSize, int** returnColumnSizes){ dfs(image,imageSize,*imageColSize,sr,sc,newColor,image[sr][sc]); *returnSize=imageSize; (*returnColumnSizes)=imageColSize; return image; }
标签:|| dfs new ret etc class fill pre color
原文地址:https://www.cnblogs.com/ganxiang/p/14049982.html