## Welcome To SDIBT ACM-ICPC Online Judge

VIRTUAL JUDGE Recent Contest F.A.Qs Discuss Home ProblemSet Status Ranklist 13 Contest LoginRegister Exam
2017 ACM 集训队预选排名~      报名入口
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 = (x1 + x2 + ... + xk)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 x1n1x2n2...xknk in expansion of the polynomial ((x1 + x2 + ... + xk)n.

## Sample Input

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

```

```2
2

```

## Source

[Submit][Status][Discuss]

HOME Back

한국어 中文 English
All Copyright Reserved 2008-2010 SDIBT TEAM
GPL2.0 2003-2010 HUSTOJ Project TEAM