这种打印矩阵的要先观察发现规律,

import sys
for line in sys.stdin:
    N=int(line.strip())
    res=[]
    for i in range(N):
        if i==0:
            res=[(e+2)*(e+1)//2 for e in range(N)]
        else:
            res=[e-1 for e in res[1:]]
        # print(res) #其实到这里核心代码就结束了
        for t in res:
              print(t,end=" ")
        print()