题解 | #蛇形矩阵#
蛇形矩阵
https://www.nowcoder.com/practice/649b210ef44446e3b1cd1be6fa4cab5e
n=int(input()) res=[[0]*n for _ in range(n)] res[0][0]=1 for i in range(1,n): res[i][0]=res[i-1][0]+i for i in range(n): for j in range(1,n-i): res[i][j]=res[i][j-1]+j+i+1 for i in range(n): print(' '.join(str(i) for i in res[i][:n-i] ))