Codeforces题解
文章平均质量分 81
Codeforces题解
Abmcar
这个人并不懒,但他还是没有填写个人简介
展开
-
Codeforces Round #787 (Div. 3) 全题解
源代码:ACM/OpenjudgeNow/Codeforces at master · abmcar/ACM (github.com)更好的阅读体验: Codeforces Round #787 (Div. 3) 全题解 - Abmcar’s 茶水间Problem - A - Codeforces大致题意:思路:可以知道缺少的狗粮和猫粮分别为min(0,a−x)min(0,a-x)min(0,a−x)和min(0,b−y)min(0,b-y)min(0,b−y) 判断通用粮是否满足缺口即可代原创 2022-05-06 10:57:32 · 618 阅读 · 3 评论 -
Codeforces Round #780 (Div. 3) (全题解)
源代码:ACM/OpenjudgeNow/Codeforces at master · abmcar/ACM (github.com)更好的阅读体验: Codeforces Round #780 (Div. 3) (全题解) - Abmcar’s 茶水间(头一次知道全A是绿色的A. Vasya and Coins题目大意:思路:思考如果没有1硬币,则只能支付2的倍数的金额,1无法支付若有一个1硬币和无限2硬币,则任意金额都可支付1=11 = 11=12=22 = 22=23=2+13原创 2022-04-07 17:02:05 · 1669 阅读 · 0 评论 -
Educational Codeforces Round 125 (Rated for Div. 2) (A-D题解)
源代码:ACM/OpenjudgeNow/Codeforces at master · abmcar/ACM (github.com)更好的阅读体验: Educational Codeforces Round 125 (Rated for Div. 2) (A-D题解) - Abmcar’s 茶水间A. Integer Moves题目大意:思路:可以知道最多只需要执行2次,一次移动横坐标,一次移动纵坐标而当x2+y2\sqrt{x^2+y^2}x2+y2为整数时 只需要一次操作即可代码:原创 2022-03-28 16:43:58 · 1289 阅读 · 0 评论 -
Codeforces Round #778 (Div. 1 + Div. 2, based on Technocup 2022 Final Round) (A-C题解)
源代码:ACM/OpenjudgeNow/Codeforces at master · abmcar/ACM (github.com)更好的阅读体验: Codeforces Round #778 (Div. 1 + Div. 2, based on Technocup 2022 Final Round) (A-C题解) - Abmcar’s 茶水间A. Maximum Cake Tastiness题目大意:思路:可以证明通过旋转可以使得最大的蛋糕和次大的蛋糕相邻因此最大美味为最大+次大代码:原创 2022-03-25 21:13:48 · 1175 阅读 · 0 评论 -
Codeforces Round #776 (Div. 3) (A-E题解)
源代码:ACM/OpenjudgeNow/Codeforces at master · abmcar/ACM (github.com)更好的阅读体验: Codeforces Round #776 (Div. 3) (A-E题解) - Abmcar’s 茶水间A. Deletions of Two Adjacent Letters题目大意:思路:题目给出了最终剩下的字母,那么我们可以判断该字母在原串中的位置,如果它前面和后面的字母数都是偶数,则可以传唤代码:void solution(){原创 2022-03-23 15:18:57 · 2158 阅读 · 0 评论 -
Educational Codeforces Round 124 (Rated for Div. 2) (A-D题解)
源代码:ACM/OpenjudgeNow/Codeforces at master · abmcar/ACM (github.com)更好的阅读体验: 折跃坐标A. Playoff题目大意:思路:比较简单的数学思路我们发现每轮会刷掉奇数位的选手不难发现和证明 最终剩下的一定是$2^n-1 $代码:void solution(){ cin >> n; cout << (1 << n) - 1 << endl;}B. P原创 2022-03-21 20:24:47 · 1227 阅读 · 0 评论 -
Codeforces Round #777 (Div. 2) (A-D题解)
源代码:ACM/OpenjudgeNow/Codeforces at master · abmcar/ACM (github.com)更好的阅读体验: 折跃坐标碎碎念:不亏是俄罗斯场+二次元出题人,只能说头像越粉出题越狠A. Madoka and Math Dad题目大意:思路:我们可以发现对于没有连续的数当中, 21212121 是和最小且最大的数,我们可以把21分为一组,问题转变为剩余部分对于n mod 3==0n~mod~3 == 0n mod&nb原创 2022-03-16 14:41:44 · 1227 阅读 · 0 评论 -
Educational Codeforces Round 123 (Rated for Div. 2) (A-D题解)
源代码:ACM/OpenjudgeNow/Codeforces at master · abmcar/ACM (github.com)更好的阅读体验: 折跃坐标A. Doors and Keys题目大意:思路:把当前得到的钥匙数存起来判断即可,可以使用isupper()和map简化代码:void solution(){ cin >> oriS; M.clear(); for (char it : oriS) { M[it]++;原创 2022-03-08 15:08:58 · 917 阅读 · 0 评论 -
Codeforces Round #772 (Div. 2) (A-D题解)
源代码:ACM/OpenjudgeNow/Codeforces at master · abmcar/ACM (github.com)更好的阅读体验: 折跃坐标A. Min Or Sum题目大意:思路:a+b >= a|b,我们可以把a,b换成0,a|b,这种形式,最终,我们可以把数组替换为若干个0和一个数组|和最终的和为数组 | 和代码:void work(){ cin >> n; int ans = 0; for (int i= 1; i原创 2022-03-08 10:33:27 · 871 阅读 · 0 评论 -
Codeforces Round #771 (Div. 2) (A-D题解)
源代码:ACM/OpenjudgeNow/Codeforces at master · abmcar/ACM (github.com)A. Reverse题目大意:思路:已知数组为一个排列,那么最优情况应该是1,2,3,4,5,6这种如果i != nums[i] 不难发现把nums[i]换为i应该是最优的变换如果有比他更优的选择,则在这个之前存在i != nums[i] 同理,再此之后的变化一定不最优代码:void work(){ cin >> n; vec原创 2022-03-07 17:08:33 · 805 阅读 · 0 评论 -
Codeforces Global Round 19 (A-D题解)
源代码:ACM/OpenjudgeNow/Codeforces at master · abmcar/ACM (github.com)A. Sorting Parts题目大意:思路:我们发现对于任意的字符串s,s+rev(s)为一个回文串,而对于一个回文串t,t+rev(t) = rev(t) + t因此我们只需要判断字符串是否为回文串即可代码:void work(){ string s; cin >> n >> m; cin >&g原创 2022-03-07 16:38:38 · 337 阅读 · 0 评论 -
Codeforces Round #770 (Div. 2) (A-D题解)
源代码:ACM/OpenjudgeNow/Codeforces at master · abmcar/ACM (github.com)A. Reverse and Concatenate题目大意:思路:我们发现对于任意的字符串s,s+rev(s)为一个回文串,而对于一个回文串t,t+rev(t) = rev(t) + t因此我们只需要判断字符串是否为回文串即可代码:void work(){ string s; cin >> n >> m;原创 2022-03-01 21:15:41 · 442 阅读 · 0 评论 -
Educational Codeforces Round 122 (Rated for Div. 2) (A-D题解)
源代码:ACM/OpenjudgeNow/Codeforces at master · abmcar/ACM (github.com)A. Div. 7题目大意:思路:对于任意一个数,在只更改最后一位的情况下,必定一种方式使得%7 == 0代码:void work(){ cin >> n; if (n % 7 == 0) { cout << n << endl; return; }原创 2022-03-01 17:02:04 · 282 阅读 · 0 评论 -
Codeforces Round #769 (Div. 2) (A-D题解)
源代码:https://github.com/abmcar/ACM/tree/master/OpenjudgeNow/Codeforces/Codeforces%20Round%20%23769%20(Div.%202)A. ABC题目大意:思路:有这么几种情况字符串大小为1,此时无法获得长度大于1的回文子串字符串的大小大于3,此时无论怎么排,都会出现"11",“00”,“101”,"010"这样的回文子串长度为2,只有"11","00"是回文子串代码:void work(){原创 2022-03-01 16:06:37 · 379 阅读 · 1 评论 -
Codeforces Round #768 (Div. 2) (A-D题解)
源代码:https://github.com/abmcar/ACM/tree/master/OpenjudgeNow/Codeforces/Codeforces%20Round%20%23768%20(Div.%202)A. Min Max Swap题目大意:思路:我们知道在两数之和相等的情况下,二者的差越大,乘积越小不难得出,该题的答案为:最小的最大值*最大的最大值,我们把同一位置上比较小的一个数字放到数组A里,比较大的一个放到数组B里代码:void work(){ cin原创 2022-02-28 21:35:32 · 123 阅读 · 0 评论 -
Codeforces Round #767 (Div. 2) (A-D)题解
源代码:https://github.com/abmcar/ACM/tree/master/OpenjudgeNow/Codeforces/Codeforces%20Round%20%23767%20(Div.%202)## A. Download More RAM题目大意:有n个软件,第i个软件运行时需要消耗ai G内存(运行完不会消失),运行完可以获得额外的bi G内存,问可以达到的最大内存是多少?(Download More RAM,这也太Magic了)思路:采用贪心的想法,对消耗的内存原创 2022-02-03 22:02:33 · 970 阅读 · 0 评论 -
Educational Codeforces Round 121 (Rated for Div. 2) (A-C)题解
源代码:https://github.com/abmcar/ACM/tree/master/OpenjudgeNow/Codeforces/Educational%20Codeforces%20Round%20121%20(Rated%20for%20Div.%202)更好的阅读体验:http://www.abmcar.top/archives/educationalcodeforcesround121ratedfordiv2A. Equidistant Letters题目大意:给你一个字符串,让你原创 2022-01-19 15:32:44 · 387 阅读 · 0 评论 -
Codeforces Round #766 (Div. 2) (A-C) 题解
更好的阅读体验:http://www.abmcar.top/archives/codeforcesround766div2a-cti-jie完整代码:https://github.com/abmcar/ACM/tree/master/OpenjudgeNow/Codeforces/Codeforces%20Round%20%23766%20(Div.%202)A. Not Shading题目大意:给你一个n*m的板子,每个格子分为黑色和白色,你可以一次选择多个黑色格子让他们的一整行或者一整列变成黑原创 2022-01-16 00:52:51 · 335 阅读 · 1 评论 -
Codeforces Round #765 (Div. 2) (A-C)题解
更好的阅读体验:http://www.abmcar.top/archives/codeforcesround765div2完整代码:https://github.com/abmcar/ACM/tree/master/OpenjudgeNow/Codeforces/Codeforces%20Round%20%23765%20(Div.%202)A. Ancient Civilization题目大意:给你n个二进制下长度小于k的数,让你求一个数,使它和其余数的二进制上的不同的个数最少思路:一道不怎原创 2022-01-12 23:41:25 · 363 阅读 · 0 评论 -
Codeforces Round #764 (Div. 3) (A-D)题解
A. Plus One on the Subset题目大意:给你一个数组,你可以一次选择其中任意一个或多个数+1,问最小操作多少次使得数组各个元素相等思路:记录最大值和最小值,答案为二者之差代码:void work(){ cin >> n; int maxn = 0; int minn = 2e9; for (int i = 0; i < n; i++) { int temp;原创 2022-01-11 00:53:44 · 548 阅读 · 0 评论 -
Codeforces Round #761 (Div. 2) (A-D1) 题解
更好的阅读体验:http://www.abmcar.top/archives/codeforcesround761div2完整代码:https://github.com/abmcar/ACM/tree/master/OpenjudgeNow/Codeforces/Codeforces%20Round%20%23761%20(Div.%202)A. Forbidden Subsequence题目大意:给你一个字符串s和t,t是”abc“的排列,求字典序最小的s的排列且t不是他的子串思路:当t不为”原创 2022-01-10 14:02:14 · 333 阅读 · 0 评论 -
Educational Codeforces Round 119 (Rated for Div. 2) (A/B/C/E) 题解
更好的阅读体验:http://www.abmcar.top/archives/educationalcodeforcesround119ratedfordiv2完整代码:https://github.com/abmcar/ACM/tree/master/OpenjudgeNow/Codeforces/Educational%20Codeforces%20Round%20119%20(Rated%20for%20Div.%202)A. Equal or Not Equal题目大意:给你一个一堆数,并知原创 2022-01-08 18:34:43 · 549 阅读 · 0 评论 -
Codeforces Round #762 (Div. 3) (A-E) 题解
更好的阅读体验:http://www.abmcar.top/archives/codeforcesround762div3完整源代码:https://github.com/abmcar/ACM/tree/master/OpenjudgeNow/Codeforces/Codeforces%20Round%20%23762%20(Div.%203)A. Square String?题目大意:给你一个字符串,让你判断这个字符串是不是由两个相同的字符串组成思路:截取源字符串的一半,拼接成一个新的字符串,跟原创 2022-01-07 19:33:10 · 529 阅读 · 0 评论 -
[Codeforces]Hello 2022(A-C)题解
更好的阅读体验:http://www.abmcar.top/archives/codeforceshello2022完整源代码:https://github.com/abmcar/ACM/tree/master/OpenjudgeNow/Codeforces/Hello%202022前排提示:本场的题十分之恶心人,不建议做A. Stable Arrangement of Rooks题目大意:给你一个大小n * n的板子 让你放k个棋子,任意一个棋子的同行同列无其他棋子,而且它向上下左右移动一格也满原创 2022-01-06 22:05:57 · 731 阅读 · 0 评论 -
Educational Codeforces Round 120 (Rated for Div. 2) (A-C) 题解
完整代码:https://github.com/abmcar/ACM/tree/master/OpenjudgeNow/Codeforces/Educational%20Codeforces%20Round%20120%20(Rated%20for%20Div.%202)更好的阅读体验:http://www.abmcar.top/archives/educationalcodeforcesround120ratedfordiv2A. Construct a Rectangle题目大意:给你三根木棍,原创 2022-01-05 16:52:44 · 651 阅读 · 0 评论 -
Codeforces Round #763 (Div. 2) (A-C) 题解
源代码:https://github.com/abmcar/ACM/tree/master/OpenjudgeNow/Codeforces/Codeforces%20Round%20%23763%20(Div.%202)cf合集:https://github.com/abmcar/ACM/tree/master/OpenjudgeNow/Codeforces更好的阅读体验:http://www.abmcar.top/archives/codeforcesround763A. Robot Cleaner原创 2022-01-03 11:05:47 · 402 阅读 · 0 评论 -
Good Bye 2021: 2022 is NEAR (A-D)题解
A. Integer Diversity.cpp题目大意:给你n个数,你可以选择任意某个数使其乘-1,问最多可以得到多少个不同的数思路:用map记录每个数出现的次数,遍历map,如果某个数出现了2次以上且它乘-1没出现过,答案+2,否则答案+1坑点:注意跳过it.second==0的情况void work(){ cin >> n; map<int,int> M; int ans = 0; for (int i = 1; i <= n;原创 2022-01-02 17:16:26 · 638 阅读 · 0 评论 -
Codeforces Round #701 (Div. 2) C. Floor and Mod (数学/思维/整除分块)
折跃坐标:https://codeforces.com/contest/1485/problem/C题面:题目大意:给你一个x,y (1 ≤ x,y ≤ 10e9) 问有多少个(a,b)满足 a / b = a mod b原创 2021-02-15 13:22:47 · 2771 阅读 · 4 评论