| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 71843 | 汤弘毅 | 方阵填数 | Python3 | Accepted | 36 MS | 3808 KB | 411 | 2024-04-27 17:38:03 |
n = int(input()) s = [] for x in range(n): s.append([0]*n) tws = ((1,0),(0,-1),(-1,0),(0,1)) x,y = 0 ,n-1 i = 1 s[x][y] = i while i < n**2: for d in tws: x, y = x + d[0], y + d[1] while 0 <= x < n and 0 <= y < n and s[x][y] == 0: i += 1 s[x][y] = i x, y = x + d[0], y + d[1] x,y = x-d[0],y-d[1] for row in s: print(*row)