#P5947. Coefficient of a Specific Term in a Polynomial Expansion
Coefficient of a Specific Term in a Polynomial Expansion
Coefficient of a Specific Term in a Polynomial Expansion
Given a polynomial expansion
$$ (x^2+x+1)^n $$
find the coefficient of the term $$x^i$$ in its expanded form.
inputFormat
The input consists of two integers n and i separated by a space, where n is the exponent in the expansion and i is the exponent of x whose coefficient is to be computed.
outputFormat
Output a single integer representing the coefficient of the term $$x^i$$ in the expanded polynomial $$ (x^2+x+1)^n $$.
sample
1 0
1