09 2020 档案

摘要:题目链接:https://codeforces.com/contest/1417/problem/A 题意 给出一个大小为 $n$ 的数组 $a$,每次操作可以选择两个数,然后将一个数加到另一个数上,要求操作后的数不能大于 $k$,问最多可以操作多少次。 题解 除一个最小值外,给每个数一直加最小值。 阅读全文
posted @ 2020-09-29 13:20 Kanoon 阅读(205) 评论(0) 推荐(0)
摘要:题目链接:https://codeforces.com/contest/1417/problem/B 题意 定义 $f(a)$ 为数组 $a$ 中满足: $i < j$ $a_i + a_j = T$ 的二元组 $(i,j)$ 的个数。 试将一个大小为 $n$ 的数组 $a$ 划分为 $b,c$ 两 阅读全文
posted @ 2020-09-29 13:00 Kanoon 阅读(219) 评论(0) 推荐(0)
摘要:题目链接:https://codeforces.com/contest/1417/problem/C 题意 给出一个大小为 $n$ 的数组 $a$,计算当 $k$ 从 $1$ 到 $n$ 取值时在所有 $k$ 长区间中出现的数的最小值。 题解 记录一个值两两间的最大距离,该距离的 $k$ 长区间及之 阅读全文
posted @ 2020-09-29 11:15 Kanoon 阅读(229) 评论(0) 推荐(0)
摘要:题目链接:https://codeforces.com/contest/1417/problem/D 题意 给出一个大小为 $n$ 的正整数数组 $a$ ,每次操作如下: 选择 $i,j$ 和 $x$,$(1 \le i, j \le n,\ 0 \le x \le 10^9)$ 令 $a_i - 阅读全文
posted @ 2020-09-28 15:00 Kanoon 阅读(388) 评论(0) 推荐(1)
摘要:比赛链接:https://codeforces.com/contest/1420 A. Cubes Sorting 题意 给出一个大小为 $n$ 的数组 $a$,每次只可以交换相邻的两个元素,最多交换 $\frac{n \cdot (n-1)}{2}-1$ 次,判断能否将数组变为非递减序。 题解一 阅读全文
posted @ 2020-09-25 10:15 Kanoon 阅读(286) 评论(2) 推荐(1)
摘要:比赛链接:https://ac.nowcoder.com/acm/contest/6874#question A - 巨木之森 题解 除了起点到终点的路径,其他的路径都会走两遍,所以为了尽可能减少折返的路径,每次应使起点终点所在路径尽可能的长,亦即二者距离尽可能的远。 最长的一条路径为树的直径,根据 阅读全文
posted @ 2020-09-23 18:00 Kanoon 阅读(179) 评论(0) 推荐(0)
摘要:比赛链接:https://codeforces.com/contest/1419 A. Digit Game 题意 给出一个 $n$ 位数,游戏规则如下: 1-indexed Raze标记奇数位 Breach标记偶数位 如果最后剩下的一位未标记位上的数字为奇数,Raze胜,为偶数,Breach胜 问 阅读全文
posted @ 2020-09-21 23:00 Kanoon 阅读(245) 评论(0) 推荐(0)
摘要:比赛链接:https://ac.nowcoder.com/acm/contest/7412 A - 牛牛和牛可乐的赌约 题解 计算模意义下的 $1 - \frac{1}{n^m}$ 即可。 代码 #include <bits/stdc++.h> using namespace std; const 阅读全文
posted @ 2020-09-20 23:30 Kanoon 阅读(297) 评论(0) 推荐(2)
摘要:比赛链接:https://atcoder.jp/contests/abc179/tasks A - Plural Form 题意 给出一个由小写字母组成的单词,如果单词以 $s$ 结尾,在单词的末尾加上 $es$,否则在单词的末尾加上 $s$ 。 代码 #include <bits/stdc++.h 阅读全文
posted @ 2020-09-20 21:00 Kanoon 阅读(367) 评论(0) 推荐(0)
摘要:比赛链接:https://atcoder.jp/contests/abc178/tasks A - not 题意 给出一个整数 $0 \le x \le 1$,如果 $x$ 是 $0$ 就输出 $1$,如果 $x$ 是 $1$ 就输出 $0$ 。 题解 输出 $x \oplus 1$ 或 $!x$ 阅读全文
posted @ 2020-09-14 15:00 Kanoon 阅读(409) 评论(0) 推荐(1)
摘要:比赛链接:https://codeforces.com/contest/1405 A. Permutation Forgery 题意 给出一个大小为 $n$ 的排列 $p$,定义 \begin{equation} F(p)=\mathrm{sort}([p_1+p_2,p_2+p_3,\ldots, 阅读全文
posted @ 2020-09-12 19:05 Kanoon 阅读(274) 评论(0) 推荐(0)
摘要:题目链接:http://lx.lanqiao.cn/problemset.page?code=BASIC BASIC-1 闰年判断 题解 模拟。 代码 #include <bits/stdc++.h> using namespace std; int main() { int y; cin >> y 阅读全文
posted @ 2020-09-11 23:26 Kanoon 阅读(213) 评论(0) 推荐(0)
摘要:题目链接:http://lx.lanqiao.cn/problemset.page?code=BEGIN BEGIN-1 A+B问题 #include <bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; 阅读全文
posted @ 2020-09-11 23:17 Kanoon 阅读(200) 评论(0) 推荐(0)
摘要:比赛链接:https://pintia.cn/market/item/1302816969611366400 7-1 多二了一点 (15分) 题解 模拟。 代码 #include <bits/stdc++.h> using namespace std; int sum(string s) { int 阅读全文
posted @ 2020-09-08 17:40 Kanoon 阅读(822) 评论(7) 推荐(0)
摘要:比赛链接:https://codeforces.com/contest/1409 A. Yet Another Two Integers Problem 题意 给出两个数 $a$ 和 $b$,有以下两种操作: $a+=k$ $a-=k$ $k \in [1, 10]$ 问将 $a$ 变为 $b$ 最 阅读全文
posted @ 2020-09-06 00:00 Kanoon 阅读(234) 评论(0) 推荐(1)
摘要:比赛链接:https://codeforces.com/contest/1400 A. String Similarity 题意 给出一个长 $2n-1$ 的二进制串 $s$,构造一个长 $n$ 的字符串,使其与 $s$ 的每个长 $n$ 的子串至少有一处字母相等。 题解 长 $n$ 的子串恰有 $ 阅读全文
posted @ 2020-09-03 00:15 Kanoon 阅读(256) 评论(0) 推荐(0)
摘要:比赛链接:https://codeforces.com/contest/1397 A. Juggling Letters 题意 给出 $n$ 个字符串,可在字符串间任意移动字母,问最终能否使这 $n$ 个字符串相同。 题解 如果可以,因为 $n$ 个字符串相同,所以每个字母的数量一定是 $n$ 的倍 阅读全文
posted @ 2020-09-01 21:40 Kanoon 阅读(229) 评论(0) 推荐(0)