-->
当前位置:首页 > 题库

PROGRAMMING:binomial theorem

Luz5年前 (2021-05-10)题库431
In elementary algebra, binomial theorem describes the algebraic expansion of binomial power
The coefficient a in a * x ^ b * y ^ C is called binomial coefficient
Now you are required to output the binomial coefficient corresponding to the nth power; Well, if you look closely, this is the well-known Yanghui triangle.
The most essential feature of Yang Hui triangle is that its two hypotenuses are all composed of the number 1, and the rest are equal to the two numbers on its shoulder
The sum of the numbers.
If you still don't understand, I can tell you a [i] [J] = a [I-1] [J-1] + a [I-1] [J];
###Input format:
A positive integer n represents the power of the binomial (1 < n < = 15)
There are multiple sets of entries for the title.
###Output format:
Output the Yang Hui triangle corresponding to the nth power.
For example, the third level 1 2 1 is the coefficient of binomial (a + b) ^ 2 expansion form a ^ 2 + 2 * a * B + B ^ 2 with power exponent 2.
See the sample for more output information.
###Input example:
Here is a set of inputs. For example:
```in
two
four
```
###Output example:
The corresponding output is given here. For example:
```out
one
1 1
1 2 1
one
1 1
1 2 1
1 3 3 1
1 4 6 4 1
```







answer:If there is no answer, please comment