随笔分类 - 组合数学
摘要:洛谷传送门 AtCoder 传送门 考虑到规定单调不降比较难搞。先设 \(g_t\) 为长度为 \(t\) 的满足条件的序列个数(可重且有顺序)。求这个可以设个 dp,\(f_{d, i}\) 表示考虑到从高到低第 \(d\) 位,当前 \(t\) 个数中有 \(i\) 个仍然顶上界,并且之前的位都
阅读全文
摘要:CF 传送门 首先考虑没有选出的数互不相同的限制。设 \(f_m\) 为选出 \(m\) 个 \(\in [0, n]\) 的数,异或 \(\text{popcount} = k\) 的方案数。可以考虑枚举这 \(m\) 个数和 \(n\) 的 \(\text{LCP}\)(要求后一位为 \(1\)
阅读全文
摘要:洛谷传送门 AtCoder 传送门 看到和度数有关的(基环)树计数,可以想到 Prufer 序。 如果要计数一棵树,那么答案就是 \(\binom{n - 2}{d_1 - 1, d_2 - 1, \ldots, d_n - 1}\)。因为度数为 \(d\) 的点在 Prufer 序中恰好出现 \(
阅读全文
摘要:洛谷传送门 CF 传送门 最小交换次数等于 \(n - \text{环数}\)。所以题目要我们统计把 \(p, q\) 补全成排列,连边 \(p_i \to q_i\),环数 \(= i\) 的方案数。 考虑把边根据 \(p_i, q_i\) 的是否已知状态分成四类: \(p \to q\) \(p
阅读全文
摘要:[UOJ 传送门](https://uoj.ac/problem/450 "UOJ 传送门") $d = 1$ 时答案显然为 $k^n$。 下面只讨论 $d = 3$ 的情况,$d = 2$ 类似。 设每个人的指数型生成函数(EGF)为 $G(x) = \sum\limits_{i = 0}^{+\
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/P4931 "洛谷传送门") 设 $f_i$ 为 $i$ 对情侣完全错位的方案数,那么答案为: $$\binom{n}{k} \frac{n!}{(n - k)!} 2^k f_{n - k}$$ 分别代表选择 $k$
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/P6667 "洛谷传送门") 点值不好搞。考虑把它搞成系数一类的东西。 由二项式反演,$f(x) = \sum\limits_{i = 0}^x \binom{x}{i} b_i \Leftrightarrow b_i
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/P4548 "洛谷传送门") 结论:答案为 $\sum\limits_{s_{1 \sim k} = s_{m - k + 1 \sim m}} n^k$。 记一下两种理解方法。 假设有人开了一个赌场,每一秒钟有一位赌
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_agc012_d "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/agc012/tasks/agc012_d "AtCoder 传送门") 不错的题。bx E
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc309_g "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc309/tasks/abc309_g "AtCoder 传送门") 前置知识:[[AR
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/CF997C "洛谷传送门") [CF 传送门](https://codeforces.com/problemset/problem/997/C "CF 传送门") 考虑容斥,钦定 $i$ 行 $j$ 列放同一种颜色,
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/P6620 "洛谷传送门") 记一下是怎么推的。 $$\sum\limits_{k = 0}^n f(k) \times x^k \times \binom{n}{k}$$ $$= \sum\limits_{p = 0
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_agc058_d "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/agc058/tasks/agc058_d "AtCoder 传送门") Orz H6_6Q
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_arc153_e "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/arc153/tasks/arc153_e "AtCoder 传送门") 我们考虑给定 $X
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_agc021_e "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/agc021/tasks/agc021_e "AtCoder 传送门") 容易发现一个变色龙
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc238_h "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc238/tasks/abc238_h "AtCoder 传送门") 考虑期望转计数,方
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc245_h "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc245/tasks/abc245_h "AtCoder 传送门") 很好的题。 下文令
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_arc162_f "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/arc162/tasks/arc162_f "AtCoder 传送门") 题目限制可以被改写
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_arc162_e "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/arc162/tasks/arc162_e "AtCoder 传送门") 完全没有思路。但是
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_arc162_d "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/arc162/tasks/arc162_d "AtCoder 传送门") 注意到,如果给定每
阅读全文

浙公网安备 33010602011771号