题解 | 杨辉三角
杨辉三角
https://www.nowcoder.com/practice/8c6984f3dc664ef0a305c24e1473729e
n = int(input())
for i in range (n):
ans=[1]
for bc in range(1,i+1):
fm=1
fz=1
for m in range(0,bc):
fm*=(i-m)
for z in range(1,bc+1):
fz*=z
temp=fm//fz
ans.append(temp)
s=" ".join(str(x) for x in ans)
print(s)
杨辉三角->求Cnm
华为HUAWEI公司氛围 740人发布
查看6道真题和解析