Educational Codeforces Round 77 (Rated for Div. 2) Heating 贪心。 inline void solve() { ll a, b; rd(a), rd(b); ll c = b / a, d = b - a * c; ll ans = d * (c + 1) * (c + 1) + (...
Codeforces Round #602 (Div. 2, based on Technocup 2020 Elimination Round 3) 题解
Codeforces Round #602 (Div. 2, based on Technocup 2020 Elimination Round 3) Math Problem 贪心。 inline void solve() { int l = 1e9 + 1, r = 0, n; rd(n); for (int i = 1; i <= n;...
CF585E Present for Vitalik the Philatelist 题解
CF585E Present for Vitalik the Philatelist 题意 有一个包含 $n$ 个 $\in [2, 10^7]$ 的整数的可重集合。 要求满足条件的一个元素 $x$ 和一个集合 $S$ 的方案数。 条件:$x \notin S$,$\gcd\{S\...
CF605E Intergalaxy Trips 题解
CF605E Intergalaxy Trips 题意 $n$ 个点的有向完全图。 $i \to j$ 的边每天出现的概率均为 $p_{i,j}$,若 $i = j$,有 $p_{i,j} = 1$。 每天选择一条存在的出边走过去。 求最优策略下从 $1$ 到 $n$ 的期...
CF549E Sasha Circle 题解
CF549E Sasha Circle 题意 $n+m$ 个整点。 询问是否存在一个圆将前 $n$ 个点和后 $m$ 个点严格分开。 $n,|x|,|y| \le 10^4$。 题解 设 $A$ 为前 $n$ 个点的集合,$B$ 为后 $m$ 个点的集合,不妨设圆内...
CF566C Logistical Questions 题解
CF566C Logistical Questions 题意 一棵 $n$ 个节点的树,点有点权,边有边权。 两点间的距离定义为两点间边权和的 $\frac 32$ 次方。 求这棵树的带权重心。 $n \le 2 \times 10^5$。 题解 设 $d(x,y)$...
计算几何 学习笔记
一直莫名不想碰的一个专题 基础知识 点、向量模板 const ld eps = 1e-10L, PI = acos(-1); struct P { ld x, y; inline P() {} inline P(ld x, ld y) : x(x), y(y) {} inline P &ope...
CSP2019 题解
CSP2019-S2 自测 格雷码 依照题意模拟即可,注意开 unsigned long long。 inline void dfs(int n, ul k) { if (!n--) return; putchar('0' + ((k >> n) & 1)); if ((k >> n) ...
CSP2019 游记
one last chance Day 0 一觉睡到中午,感觉明天早上要起不来了。 吃过午饭,带着 wjyyy/ouuan/EternalAlexander 的 XR 抱枕冲到华科。 由于到的比较早,所以试机的地方还没有多少人,随便找了一排坐下。 ...
【LGR-065】洛谷 11 月月赛 III Div.2 题解
【LGR-065】洛谷 11 月月赛 III Div.2 基础字符串练习题 前缀和 + 贪心。 注意「非空子串」。 const int N = 1e5 + 7; int n, ans = -1; char s[N]; int main() { rds(s, n); for (int i = 1, o...