784 - Maze Exploration
#include
#include
char maze[50][100];
void search(int i,int j)
{
if(maze[i][j]!='*' && maze[i][j]!='_' && maze[i][j]!=' ')
return;
maze[i][j]='#';
search(i-1,j-1);
search(i-1,j);
search(i-1,j+1);
search(i,j-1);
search(i,j+1);
search(i+1,j-1);
search(i+1,j);
search(i+1,j+1);
}
int main()
{
int n;
scanf("%d",&n);
getchar();
while(n--)
{
memset(maze,'0',sizeof(maze));
int h=0,w=0;
while(gets(maze[h]) && maze[h][0]!='_')
{
if(strlen(maze[h])>w)
w=strlen(maze[h]);
h++;
}
for(int i=0;i