Submit | All submissions | Best solutions | Back to list |
COEF - Coeficientes |
The problem is to calculate the coefficients in expansion of polynomial (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 < n, k <13). This integers define the power of the polynomial and the amount of the 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 one integer, the coefficient by the monomial x1n1x2n2...xknk in expansion of the polynomial (x1+x2+...+xk)n.
Example
Input: 2 2 1 1 2 12 1 0 0 0 0 0 0 0 0 0 1 0 Output: 2 2
Added by: | Coach UTN FRSF |
Date: | 2010-06-02 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: NODEJS OBJC PERL6 SQLITE VB.NET |
Resource: | http://uva.onlinejudge.org/external/101/10105.html |
hide comments
|
|||||||
2010-10-23 18:33:05 Ehor Nechiporenko
Can somebody to explain why I have recived SIGSEGV result in my solution? |
|||||||
2010-10-23 05:32:06 Vinay Saini
AC ... Last edit: 2011-09-07 14:03:44 |
|||||||
2010-07-04 17:48:40 Michael T
It seems there're blank lines in the input. Cost me few nzecs. Last edit: 2010-07-05 20:11:37 |