python">defdfs(x, y, path, grid):n =len(grid)m =len(grid[0])if x == n-1and y == m-1:for cor in path:print("({},{})".format(cor[0],cor[1]))# 判断条件:1不能越界 2不能撞墙 3走过的不能走if0<= x+1< n and0<= y < m and grid[x+1][y]!=1:path.append((x+1, y))grid[x+1][y]=1dfs(x+1, y, path, grid)path.pop()grid[x +1][y]=0if0<= x-1< n and0<= y < m and grid[x-1][y]!=1:path.append((x-1, y))grid[x-1][y]=1dfs(x-1, y, path, grid)path.pop()grid[x -1][y]=0if0<= x < n and0<= y+1< m and grid[x][y+1]!=1:path.append((x, y+1))grid[x][y+1]=1dfs(x, y+1, path, grid)path.pop()grid[x][y +1]=0if0<= x < n and0<= y-1< m and grid[x][y-1]!=1:path.append((x, y-1))grid[x][y-1]=1dfs(x, y-1, path, grid)path.pop()grid[x][y -1]=0if __name__ =="__main__":n, m =map(int,input().split())grid =[]for _ inrange(n):grid.append(list(map(int,input().split())))# print(grid)path =[(0,0)]grid[0][0]=1dfs(0,0,path, grid)
a 生成数据集,数据由 Y X β ϵ YX\beta\epsilon YXβϵ产生,其中 p 20 , n 1000 p20,n1000 p20,n1000
#way1
set.seed(1)
p 20
n 1000
x matrix(rnorm(n*p), n, p)
B rnorm(p)
B[3] 0
B[4] 0
B[9] 0
B[19…