题解 | 蛇形矩阵
while True: try: n=int(input()) num=1 matri=[[0]*(n+1) for i in range(n+1)] count=0 for i in range(1,n+1): inde=list(range(1,i+1)) #print(inde) for j in inde: matri[inde[-j]][j]=num num+=1 for i in range(1,n+1): print(" ".join(map(str,[j for j in matri[i][:] if j!=0]))) except: break