Codeforces - 1139D - Steps to One
地址https://codeforces.com/contest/1139/problem/D原文地址https://www.lucien.ink/archives/409题意模拟一个循环,一开始有一个空序列,之后每次循环:从 $[1, m]$ 中等概率选出一个数字添加到序列里去。检查这个序列所有元素的 $gcd$ 是否为 $1$,如果为 $1$ 则停止,若否则重复 $1$ 操作直至 $gc...
地址https://codeforces.com/contest/1139/problem/D原文地址https://www.lucien.ink/archives/409题意模拟一个循环,一开始有一个空序列,之后每次循环:从 $[1, m]$ 中等概率选出一个数字添加到序列里去。检查这个序列所有元素的 $gcd$ 是否为 $1$,如果为 $1$ 则停止,若否则重复 $1$ 操作直至 $gc...
地址https://codeforces.com/contest/1139/problem/C原文地址https://www.lucien.ink/archives/408题解容斥一下。代码https://pasteme.cn/4939#include <bits/stdc++.h> typedef long long ll; const int maxn = int(2e5) ...
地址https://codeforces.com/contest/1139/problem/B原文地址https://www.lucien.ink/archives/407题意你有 $n$ 堆物品,第 $i$ 堆物品有 $a_i$ 个,如果你要从第 $i$ 堆物品中取走 $x_i$ 个,那么对于 $1 \leq j < i$ ,必须满足 $x_j < x_i \vee x_j =...
地址https://codeforces.com/contest/1139/problem/A原文地址https://www.lucien.ink/archives/406/题意给你一个只包含数字的字符串,问有多少个子串是偶数。代码https://pasteme.cn/4937#include <bits/stdc++.h> typedef long long ll; const...
地址https://codeforces.com/contest/1098/problem/C原文地址https://www.lucien.ink/archives/402/题意能否构造出一棵 $n$ 个节点的树,使得以每个点为根的子树的 $size$ 加起来等于 $s$ ,如果能,输出使得儿子最多的点的儿子数目最少的那种。题解不难看出,以每个点为根的子树的 $size$ 加起来的和等价于每...