BZOJ3028: 食物(生成函数)

题意

链接

Sol

生成函数入门题。

对每个物品分别列一下,化到最后是(frac{x}{(1-x)^4})

根据广义二项式定理,最后答案是(C_{(N - 1) + 4 - 1}^{4-1} = C_{n+2}^3)

N = int(input())
print(int((N + 1) * (N + 2) * N / 6) % 10007)
原文地址:https://www.cnblogs.com/zwfymqz/p/10525576.html