小球问题

#include <cstdio>
#include <iostream>
#define LL long long
using namespace std;

const int MAXN = 1005;

int dp[MAXN][MAXN], f[MAXN][MAXN];

LL C (int, int);
LL A (int, int);
LL DP (int, int);//n个相同的球分到m个相同的盒子里
LL factorial (int);
LL quick_pow (LL, int);
LL Second_Stirling (int, int);

int main () {
    return 0;
}

LL C (int x, int y) {
    return factorial (x) / (factorial (y) * factorial (x - y));
}

LL A (int x, int y) {
    return factorial (x) / factorial (x - y);
}

LL DP (int x, int y) {
    f[0][0] = 1;
    for (int i = 1; i <= x; i++) {
        for (int j = 1; j <= y && j <= i; j++) {
            if (f[i][j]) continue;
            for (int k = 0; k <= j; k++) {
                f[i][j] += f[i - j][k];
                f[i][j] %= MO;
            }
        }
    }
    return f[x][y];
}

LL Second_Stirling (int x, int y) {
    dp[0][0] = 1;
    for (int i = 1; i <= x; i++) {
        for (int j = 1; j <= y; j++) {
            dp[i][j] = j * dp[i - 1][j] + dp[i - 1][j - 1];
        }
    }
    return dp[x][y];
}

LL quick_pow (LL x, int y) {
    LL ans = 1;
    while (y) {
        if (y & 1) ans *= x;
        x *= x;
        y >>= 1;
    }
    return ans;
}

LL factorial (int x) {
    LL sum = 1;
    for (int i = 1; i <= x; i++) {
        sum *= i;
    }
    return sum;
}
posted @ 2020-10-16 21:06  C2022lihan  阅读(45)  评论(0编辑  收藏  举报