题解 | #蛇形矩阵#
蛇形矩阵
https://www.nowcoder.com/practice/649b210ef44446e3b1cd1be6fa4cab5e
n=int(input()) first_row=[(nn+1)*(nn+2)//2 for nn in range(n)] for i in range(n): for j in range(n-i): print(first_row[i+j]-i,end=' ') # 使用i+j作为索引 print('')
蛇形矩阵
https://www.nowcoder.com/practice/649b210ef44446e3b1cd1be6fa4cab5e
n=int(input()) first_row=[(nn+1)*(nn+2)//2 for nn in range(n)] for i in range(n): for j in range(n-i): print(first_row[i+j]-i,end=' ') # 使用i+j作为索引 print('')
相关推荐