题意:求多项式的系数,套用公式:由(a+b+...+z)^n=n!/(k!*...z!)*a^k*b^d*...*f^z(k+d+...z = n);
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int MAXN = 50;
int ans[MAXN],m,k,a;
void init(){
ans[0] = 1;
for (int i = 1; i < 13; i++)
ans[i] = ans[i-1] * i;
}
int main(){
int n,k;
init();
while (scanf("%d%d",&n,&k) != EOF){
a = ans[n];
for (int i = 0; i < k ; i++){
int cnt;
scanf("%d",&cnt);
a /= ans[cnt];
}
printf("%d\n",a);
}
return 0;
}