题解 | #蛇形矩阵#
蛇形矩阵
http://www.nowcoder.com/practice/649b210ef44446e3b1cd1be6fa4cab5e
while True: try: n = int(input()) j = 1 l = []
for i in range(n):
l.append(i+j)
j += i
for row in l:
x = []
for i in range((n - l.index(row))):
if len(x) == 0:
x.append(row)
else:
step = l.index(row) + 1
step += i
x.append(x[-1] + step)
print(' '.join([str(x) for x in x]))
except:
break