随笔分类 - Codeforces
摘要:Pinely Round 4 (Div. 1 + Div. 2)(A - F) A - Maximize the Last Element 解题思路: 只有奇数位置能选。偶数位置前后都有奇数个数字,无法删完。 代码: #include <bits/stdc++.h> using namespace
阅读全文
摘要:Codeforces Round 960 (Div. 2)(A - D) A - Submission Bait 解题思路: 假设直接选最大数,如果最大数有奇数个,\(Alice\)必胜,反之必败。 根据这个思路,从大到小看数字,找到第一个出现奇数次的数,从它开始选,就能保证每次\(Alice\)选
阅读全文
摘要:Educational Codeforces Round 167 (Rated for Div. 2) A. Catch the Coin 解题思路: 最终\(x\)一定会相等,我们考虑直接到下面接住他。 代码: #include <bits/stdc++.h> using namespace st
阅读全文
摘要:Codeforces Round 955 (Div. 2, with prizes from NEAR!) A. Soccer 解题思路: \(a\)区间为\([x_1, x_2]\),\(b\)区间为\([y_1, y_2]\)。二者不相交则不可能出现同分。 代码: #include <bits/
阅读全文
摘要:Codeforces Round 934 (Div. 2) A - Destroying Bridges 解题思路: 完全图每个点的连边数为\(n - 1\)。 \(k < n - 1\):都可到达。 \(k \geq n - 1\):将点\(1\)的边删完,只能呆在点\(1\)。 代码: #inc
阅读全文
摘要:Educational Codeforces Round 163 (Rated for Div. 2) A - Special Characters 解题思路: 一个相同的连续段会贡献两个特殊字符,所以答案一定是偶数,找个不同的数分隔开即可。 代码: #include <bits/stdc++.h>
阅读全文
摘要:Codeforces Round 933 (Div. 3) A - Rudolf and the Ticket 解题思路: 暴力。 代码: #include <bits/stdc++.h> using namespace std; using ll = long long; using pii =
阅读全文
摘要:Codeforces Round 932 (Div. 2) A - Entertainment in MAC 解题思路: 如果翻转字符小于原字符,那么一直翻转即可。 否则,翻转\(n - 1\)次,然后添加一次。 代码: #include <bits/stdc++.h> using namespac
阅读全文
摘要:Codeforces Round 931 (Div. 2) A - Too Min Too Max 解题思路: 最大、最小、次大、次小。 代码: #include <bits/stdc++.h> using namespace std; using ll = long long; using pii
阅读全文
摘要:Codeforces Round 930 (Div. 2) A - Shuffle Party 解题思路: \(1\)会按着\(2\)的整数次幂往后跳。 代码: #include <bits/stdc++.h> using namespace std; using ll = long long; u
阅读全文
摘要:Educational Codeforces Round 160 (Rated for Div. 2) A - Rating Increase 代码: #include <bits/stdc++.h> using namespace std; typedef long long ll; const
阅读全文
摘要:Codeforces Round 929 (Div. 3) A - Turtle Puzzle: Rearrange and Negate 代码: #include <bits/stdc++.h> using namespace std; using ll = long long; using pi
阅读全文
摘要:Educational Codeforces Round 162 (Rated for Div. 2) A - Moving Chips 解题思路: 模拟一下,不难发现是\(1\)之间\(0\)的个数。 代码: #include <bits/stdc++.h> using namespace std
阅读全文
摘要:Codeforces Round 927 (Div. 3) A - Thorns and Coins 解题思路: 出现连续两个障碍之前,所有金币都能拿到。 代码: #include <bits/stdc++.h> using namespace std; using ll = long long;
阅读全文
摘要:Codeforces Round 925 (Div. 3) A - Recovering a Small String 解题思路: 枚举. 代码: #include <bits/stdc++.h> using namespace std; using ll = long long; using pi
阅读全文
摘要:Codeforces Round 924 (Div. 2) A - Rectangle Cutting 解题思路: 初始矩形长宽为\((a,b)\),如果我们切\(a\),那么一定不能再拼接\(a\),否则一定一样。所以我们拼接\(b\),即将\(a\)对半分开得到两个\((\frac{a}{2},
阅读全文
摘要:Codeforces Round 921 (Div. 2) 推荐题解 A - We Got Everything Covered! 解题思路: 以前\(k\)个字符都出现过至少一次为一轮,构造\(n\)轮即可。 代码: #include <bits/stdc++.h> using namespace
阅读全文
摘要:Educational Codeforces Round 161 (Rated for Div. 2) A - Tricky Template 代码: #include <bits/stdc++.h> using namespace std; using ll = long long; using
阅读全文
摘要:Codeforces Round 920 (Div. 3) A - Square 解题思路: 取左下角和右上角。 代码: #include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<ll,
阅读全文
摘要:Codeforces Round 919 (Div. 2) A. Satisfying Constraints 解题思路: 确定最大下界和最小上界。 然后看有多少个不可选数在界内。 代码: #include <bits/stdc++.h> using namespace std; using ll
阅读全文