Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
83804 胡海峰老师 同行列对角线的格 Python3 Accepted 34 MS 3832 KB 845 2024-07-14 22:21:51

Tests(4/4):


Code:

n,i,j = map(int,input().split()) res =[] for col in range(1,n+1): res.append("({},{})".format(i,col)) res1 = " ".join(res) res.clear() for row in range(1,n+1): res.append("({},{})".format(row,j)) res2 = " ".join(res) res.clear() i0=i;j0=j while i0>1 and j0>1: i0-=1 j0-=1 res.append("({},{})".format(i0, j0)) while i0<n and j0<n: i0+=1 j0+=1 res.append("({},{})".format(i0, j0)) res3 = " ".join(res) # res.clear() # for x in range(1,n+1): # for y in range(1,n+1): # if x-y == i-j: # res.append("({},{})".format(x, y)) # res3 = " ".join(res) res.clear() for x in range(n,0,-1): for y in range(n,0,-1): if x+y == i+j: res.append("({},{})".format(x, y)) res4 = " ".join(res) print(res1) print(res2) print(res3) print(res4)