编译失败………………
  • 板块P1605 迷宫
  • 楼主renzecheng
  • 当前回复6
  • 已保存回复6
  • 发布时间2023/7/9 20:55
  • 上次更新2023/11/3 10:51:36
查看原帖
编译失败………………
616059
renzecheng楼主2023/7/9 20:55

本机上能过呀

#include<iostream>
using namespace std;
struct tp{
	int x,y;
}f[10001];
int a[101][101];
tp start,end;
int n,m,t,ans;
void dfs(int fx,int fy)
{
	if(fx<=0||fx>n||fy<=0||fy>m||a[fx][fy]==1)
	{
		return;
	}
	if(fx==end.x&&fy==end.y)
	{
		ans++;
		return;
	}
	a[fx][fy]=1;
	dfs(fx+1,fy);
	dfs(fx,fy+1);
	dfs(fx-1,fy);
	dfs(fx,fy-1);
	a[fx][fy]=0;
	
}
int main()
{
	cin>>n>>m>>t;
	cin>>start.x>>start.y;
	cin>>end.x>>end.y;
	for(int i=1;i<=t;i++)
	{
		cin>>f[i].x>>f[i].y;
		a[f[i].x][f[i].y]=1;
	}
	dfs(start.x,start.y);
	cout<<ans;
	return 0;
}
2023/7/9 20:55
加载中...