输出前N行杨辉三角
//将n行杨辉三角输入数组a,并输出
void printYHSanJiao(int n, int[][] a) {
//赋值
for (int i = 0; i < n; i++) {
for (int j = 0; j < i + 1; j++) {
if((j == 0) || (j == i)) a[i][j] = 1;
else a[i][j] = a[i-1][j-1] + a[i-1][j];
}
//输出
for (int k = 0; k < i + 1; k++) {
System.out.print(a[i][k] + " ");
}
System.out.println();
}
}