Remember the Yang Hui triangle you learned in middle school? The specific definition is not described here, you can refer to the following figure:
The input data contains multiple test instances. The input of each test instance contains only a positive integer n (1 <= n <= 30), which represents the number of layers of the Yang Hui triangle to be output.
Corresponding to each input, please output the Yanghui triangle of the corresponding number of layers. The integers of each layer are separated by a space, and a blank line is added after each Yanghui triangle.
As you can see from the picture, for each unit, there is :
$$
y[i][j] = y[i - 1][j - 1] + y[i - 1][j]
$$
1 |
|