题解 | #蛇形矩阵#
蛇形矩阵
http://www.nowcoder.com/practice/649b210ef44446e3b1cd1be6fa4cab5e
while True: try: n = int(input())
li=[1]
for i in range(1 , n):
li.append(li[-1]+i)
# print(li)
l = []
for c, i in enumerate(li,1):
l.append(i)
for j in range(c+1 , n+1):
l.append(l[-1]+j)
print(' '.join(map(str,l)))
l=[]
# lj = [1]
# for i in range(2, n + 1):
# lj.append(lj[-1] + i)
# print(lj)
except:
break