摘要: 题目链接:https://darkbzoj.tk/problem/2287 $f[x]$表示普通0/1背包的计数 $g[x]$表示不选当前物品,装满x体积的方案数 正难则反 如果$w[i]>x$,则不可能被选,\(g[x] = f[x]\) 如果$w[i]<=x$,则考虑总方案数减去选了i的方案数, 阅读全文
posted @ 2020-10-22 23:36 Tartarus_li 阅读(208) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://codeforces.com/problemset/problem/553/Asuoy 令 \(dp[i]\) 表示前 k 个颜色的答案 当前颜色,肯定有一个球在最后,将剩余的$c[i]-1$个球插到前面所有球中的方案数是 \({tot + c[i] - 1 \choose 阅读全文
posted @ 2020-10-22 22:53 Tartarus_li 阅读(86) 评论(0) 推荐(0) 编辑
摘要: 数学不好。。写博客记录一下 组合数 n 个数里选 m 个,不关心选的顺序 $$ {n \choose k} = \frac{n(n-1)\cdots(n-k+1)}{k(k-1)\cdots1}=\frac{n!}{k!(n-k)!}$$ 阅读全文
posted @ 2020-10-22 22:14 Tartarus_li 阅读(68) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include #include #include using namespace std; typedef long long ll; const int maxn = 1000000; int k,m,num,cntf,c 阅读全文
posted @ 2020-10-22 01:38 Tartarus_li 阅读(129) 评论(0) 推荐(0) 编辑