还是50分求助,但找不到逻辑上的错误

P1605 迷宫

![](https://alpha1022.img.ihcr.top/cxk.jpg) ```c #include <queue> #include <math.h> #include <stack> #include <stdio.h> #include <iostream> #include <vector> #include <iomanip> #include <string.h> #include <algorithm> using namespace std; #define LL long long const int N = 1e6 + 10; const int INF = 0x3f3f3f3f; int n , m , t; int a[10][10]; int sx,sy,ex,ey; int ans = 0; int dx[] = {1,0,-1,0}; int dy[] = {0,1,0,-1}; void dfs(int nx, int ny) { if(nx == ex && ey == ny) { ans ++; return ; } for(int i = 0 ; i < 4 ; i++) { int x = nx + dx[i]; int y = ny + dy[i]; if(x < 1 || y < 1 || x > n || y > m || a[x][y] == 1) continue; a[x][y] = 1; dfs(x,y); a[x][y] = 0; } } int main() { cin >> n >> m >> t; cin >> sx >> sy >> ex >> ey; while(t--) { int x,y; cin >> x >> y; a[x][y] = 1; } a[sx][sy] = 1; dfs(sx,sy); cout << ans << endl; return 0; } ```
by limingjie2009 @ 2022-07-24 22:39:51


@[limingjie2009](/user/663060) 小黑子鸡脚露出来了
by anonymous_letter @ 2022-07-24 23:11:38


@[limingjie2009](/user/663060) 谢谢,过了
by hanzuorui @ 2022-07-25 10:12:51


@[limingjie2009](/user/663060) 就是问一下你的那一大堆头文件是什么意思
by hanzuorui @ 2022-07-25 10:13:45


|