题解 | #蛇形矩阵#
蛇形矩阵
https://www.nowcoder.com/practice/649b210ef44446e3b1cd1be6fa4cab5e
while True: try: N=int(input()) li=[i+1 for i in range((N+1)*N//2)] for i in range(N): x=-1 y=1 ll=[] for j in range(0,N-i): x+=y y+=1 print(li[x],end=' ') ll.append(li[x]) print() li=sorted(list(set(li)-set(ll))) except: break