题解 | 杨辉三角
杨辉三角
https://www.nowcoder.com/practice/8c6984f3dc664ef0a305c24e1473729e
#include <stdio.h>
int main() {
int n;
scanf("%d",&n);
int b[1000][1000] = {0};
for(int i=0;i<n;i++){
b[i][0]=1;
for(int j=1;j<=i;j++){
b[i][j]=b[i-1][j-1]+b[i-1][j];
}
}
for(int i=0;i<n;i++){
for(int j=0;j<=i;j++){
printf("%d ",b[i][j]);
}
printf("\n");
}
return 0;
}