题解 | #蛇形矩阵#
蛇形矩阵
https://www.nowcoder.com/practice/649b210ef44446e3b1cd1be6fa4cab5e?tpId=37&tqId=21258&rp=1&ru=/exam/oj/ta&qru=/exam/oj/ta&sourceUrl=%2Fexam%2Foj%2Fta%3FtpId%3D37&difficulty=undefined&judgeStatus=undefined&tags=&title=
n=int(input()) a=1 for i in range(n): a += i b=a for j in range(i,n): print(b,end=' ') b +=j+2 print()
做题的时候把自己绕进去了,最后写出来看上去很简洁,大家如果没事做可以看一看理一理逻辑来徒增烦恼,我尝试了半个小时也没办法把这个逻辑简短的表述出来