题解 | #蛇形矩阵#Python 动态规划
蛇形矩阵
https://www.nowcoder.com/practice/649b210ef44446e3b1cd1be6fa4cab5e
规,万物皆可规!动态规划启动!
a = int(input())
st = 1
for i in range(a):
st = st + i
ls = st
res = []
for j in range(a-i):
res.append(str(ls))
ls = ls + i+2+j
print(" ".join(res))
查看7道真题和解析