-
Notifications
You must be signed in to change notification settings - Fork 16
/
COEF.cpp
49 lines (43 loc) · 777 Bytes
/
COEF.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include<cstdio>
#include<iostream>
#include<string>
#include<cstdlib>
#include<queue>
#include<stack>
#include<utility>
#include<string>
#include<cstring>
#include<set>
#include<cmath>
#include<vector>
#include<fstream>
#include<map>
#include<list>
#include<algorithm>
typedef long long int LLD;
typedef unsigned long long int LLU;
using namespace std;
int mat[14][14];
void prepare(){
mat[0][0] = 1;
for(int i=1;i<14;i++){
mat[i][0] = mat[i][i] = 1;
for(int j=1;j<i;j++)
mat[i][j] = mat[i-1][j-1] + mat[i-1][j];
}
}
int main(){
int value, n, k;
LLD res;
prepare();
while(scanf("%d%d", &n, &k) != EOF){
res = 1;
for(int i=0;i<k;i++){
scanf("%d", &value);
res *= (LLD)(mat[n][value]);
n -= value;
}
printf("%d\n", res);
}
return 0;
}