全部评论 7

  • 为了罐头,点赞+评论

    20小时前 来自 浙江

    3
  • d

    10小时前 来自 浙江

    0
  • 这不今天考试题目

    16小时前 来自 浙江

    0
  • 算法层面上似乎没有(?)但是想要跑的比你快的代码还是有的

    16小时前 来自 浙江

    0
  • d

    17小时前 来自 四川

    0
  • #include <stdio.h>
    short n,m,vis[41][41],sum,sx,sy,fx,fy,zhx,zhy,t;
    short a[51][51],dx[]={1,-1,0,0};
    short dy[]={0,0,1,-1};
    void f(int x,int y){
    	if(x==fx&&y==fy){
    		sum++;
            return;
    	}
    	vis[x][y]=1;
    	for(int i=0;i<4;i++){
    		int nx=x+dx[i];
    		int ny=y+dy[i];
    		if(vis[nx][ny])continue;
    		if(nx<1||nx>n||ny<1||ny>m){
    			continue;
    		}
    		if(a[nx][ny]==1){
    			continue;
    		}
    		f(nx,ny);
    	}
        vis[x][y]=0;
    	
    }
    int main(){
    	scanf("%hd %hd %hd",&n,&m,&t);
        scanf("%hd %hd %hd %hd",&sx,&sy,&fx,&fy);
    	for(int j=1;j<=t;j++){
    		scanf("%hd %hd",&zhx,&zhy);
            a[zhx][zhy]=1;
    	}
    	f(sx,sy);
    	printf("%hd",sum);
    }
    

    18小时前 来自 云南

    0
  • 我和“三角洲和我的世界粉都可加(群主都玩)”的小伙伴都在ACGO等你,快用这个专属链接加入我们吧!传送

    20小时前 来自 江苏

    0

热门讨论