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
hide comments
|
vineetpratik:
2016-06-22 07:35:42
multinomial coefficient and proper EOF.
|
|
azam_9:
2016-05-28 19:54:34
just take care input format..i.e EOF to terminate the input in C...rest piece of cake. Last edit: 2016-05-28 19:54:48 |
|
aishik_pyne:
2015-09-19 08:51:12
what are the number of inputs?
|
|
Mayank Garg:
2015-04-04 11:26:59
my 50th !!
|
|
Sahil Dua:
2014-11-08 06:47:07
Simple one. Keep trying, until you get AC in 0.00 |
|
jinkies:
2014-10-15 12:51:18
very easy, just terminate input properly |
|
Jackson:
2014-10-10 07:16:42
Easy one...... Read Multinomial coefficients in Multinomial theorem.. |
|
candide:
2014-04-21 04:29:35
Problem statement doesn't warn you about leading and trailing blank lines ... |
|
Bhavik:
2014-01-02 22:00:52
another trick goes in the bag.... |
|
P_Quantum:
2013-09-20 06:30:46
Easy maths..!! |
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 |