迷宮問題の再帰的解


#include 

#define M 10//    
#define N 10

int endi=7;//   
int endj=3;

int v[M][N]={0};//   ,  a[i][j]      

bool search(int i,int j, int a[M][N])
{
	if(v[i][j]==1)return false;//  a[i][j]     ,     ,       1.       
	v[i][j]=1;
	
	if(i==endi && j==endj)//           
	{
		return true;
	}
	if(a[i][j]==1)//     
	{
		return false;
	}
	if(a[i][j]==0)//    ,          。
	{
		if(search(i-1,j,a)){cout<