题解 | #蛇形矩阵#
蛇形矩阵
https://www.nowcoder.com/practice/649b210ef44446e3b1cd1be6fa4cab5e
n = int(input()) first_of_line = 1 # 每行第一个数 for i in range(n): # i表示行数 first_of_line += i num = n - i # 每行有多少个数 out = first_of_line # 输出的数 for j in range(num): print(out, end=' ') out += i + j + 2 # 看规律总结 print()