Codeforces Round #258 (Div. 2) Devu and Flowers E. Devu and Flowers time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Devu wants to decorate his garden with flowers. He has purchased n boxes…
多重集求组合数,注意到\(n = 20\)所以可以用\(2 ^ n * n\)的容斥来写. 如果没有限制那么答案就是\(C(n + s - 1, n - 1)\).对每一个限制依次考虑,加上有一种选多的,减去有两种选多的,以此类推. 由于\(n <= 20\),所以组合数事实上是可以\(O(N)\)求的=_= #include <bits/stdc++.h> using namespace std; #define int long long const int Mod = 100000…