## Welcome To SDIBT ACM-ICPC Online Judge

Problem 1051. -- Polynomial coefficients ## Polynomial coefficients

Time Limit: 1 Sec Memory Limit: 64 MB

Submit: 9 Solved: 5

[Submit][Status][Discuss]## Description

This problem seeks the coefficients resulting from the expansion of the polynomial

*P* = (*x*_{1} + *x*_{2} + ... + *x*_{k})^{n}

## Input

The input will consist of a set of pairs of lines. The first line of the pair consists of two integers n and k separated with space ( 0 < k, n < 13). These integers define the power of the polynomial and the number of variables. The second line in each pair consists of k non-negative integers n1,..., nk, where n1 + ... + nk = n.

## Output

For each input pair of lines the output line should consist of one integer, the coefficient of the monomial *x*_{1}^{n1}*x*_{2}^{n2}...*x*_{k}^{nk} in expansion of the polynomial ((*x*_{1} + *x*_{2} + ... + *x*_{k})^{n}.

## Sample Input

2 2
1 1
2 12
1 0 0 0 0 0 0 0 0 0 1 0

## Sample Output

2
2

## HINT

## Source

[Submit][Status][Discuss]

HOME
Back

한국어 中文 English

All Copyright Reserved 2008-2010 SDIBT TEAM

GPL2.0 2003-2010 HUSTOJ Project TEAM

Anything about the Problems, Please Contact Admin:admin