m = int(input())
arr = [[0 for i in range(m)] for i in range(m)]
if m == 1:
print(1)
elif m == 2:
print(1)
print(1,1)
else:
print(1)
print(1,1)
arr[1][0] = arr[1][1] = 1
for i in range(2,m):
arr[i][0] = arr[i][i] = 1
for j in range(1,i):
arr[i][j] = arr[i-1][j-1]+arr[i-1][j]
for j in range(i+1):
print(arr[i][j], end=' ')
print()
蓝桥杯大赛 基础练习 Python- 基础练习 杨辉三角形
最新推荐文章于 2022-05-03 19:55:04 发布