提交时间:2023-11-14 17:22:58
运行 ID: 110585
#include<bits/stdc++.h> using namespace std; int m,n; bool lose=0; void print() { } void search(int a,int b) { if (a==1&&b==1) { print(); return 0; } else { if (map[a-1][b]==0) { road[a-1][b]=1; search(a-1,b); road[a-1][b]=0; } if (map[a][b-1]==0) { road[a][b-1]=1; search(a,b-1); road[a][b-1]=0; } if (map[a+1][b]==0) { road[a+1][b]=1; search(a,b-1); road[a+1][b]=0; } if (map[a][b+1]==0) { road[a][b+1]=1; search(a,b-1); road[a][b+1]=0; } } } int main() { cin>>m>>n; int map[m+1][n+1],road[m+1][n+1]; for (int i=1;i<=m;i++) { for (int j=1;j<=m;j++) { cin>>map[i][j]; road[i][j]=0; } } search(m,n); cout<<num; return 0; }