uva10105 多项式定理

来源:互联网 发布:php淘宝客sdk实例 编辑:程序博客网 时间:2024/06/05 11:16



#include <iostream>#include <cstdio>using namespace std;typedef long long LL;LL c[13][13];void init(){    for(int i = 0; i < 13; i++){        c[i][0] = 1;        for(int j = 1; j < i; j++)            c[i][j] = c[i-1][j]+c[i-1][j-1];        c[i][i] = 1;    }}/**C[][]n!/(n1!*n2!*...*nk!)**/int main(){//    freopen("data.in", "r", stdin);    int n, k, x;    LL ans;    init();    while(scanf("%d%d", &n, &k) != EOF){        ans = 1;        while(k--){            scanf("%d", &x);            ans *= c[n][x];            n-=x;        }        printf("%lld\n", ans);    }    return 0;}


0 0
原创粉丝点击