codeforces
文章平均质量分 71
ddgo
给我高高飞起来啊!(ACM退役,转JAVA后端了)
展开
-
Educational Codeforces Round 113 (Rated for Div. 2)
Educational Codeforces Round 113 (Rated for Div. 2)文章目录[Educational Codeforces Round 113 (Rated for Div. 2)](https://codeforces.ml/contest/1569)A. Balanced Substring解释代码B. Chess Tournament解释代码C. Jury Meeting解释代码D. Inconvenient Pairs解释代码A. Balanced Substr原创 2021-09-11 15:36:32 · 196 阅读 · 0 评论 -
Codeforces Round #742 (Div. 2)
Codeforces Round #742 (Div. 2)A. Domino Disaster解释输入输出代码int tt; cin>>tt;while(tt --) { int n; cin>>n; string s,ans = ""; cin>>s; for(int i=0;i<n;i++) { if(s[i] == 'L' || s[i] == 'R') ans += s[i]; else原创 2021-09-11 14:36:33 · 128 阅读 · 0 评论 -
Deltix Round, Summer 2021 (Div. 1 + Div. 2)
Deltix Round, Summer 2021 (Div. 1 + Div. 2)地址文章目录Deltix Round, Summer 2021 (Div. 1 + Div. 2)A解释:代码B解释代码C解释D解释代码E解释代码A解释:令a < b , 操作一步可以构造 (−x,x)(-x,x)(−x,x) 再次操作可以使得使得a和b补全a和b的2x差值,当x为奇数,无解。特判,当x为0且a=0,则操作0步,当x为0且a != 0,操作一步。综上,令 x = b - a.x %原创 2021-09-01 22:12:33 · 105 阅读 · 0 评论 -
Codeforces Round #734 (Div. 3)
Codeforces Round #734 (Div. 3)文章目录A. Polycarp and Coins解释代码B1. Wonderful Coloring - 1解释代码B2. Wonderful Coloring - 2解释代码C. Interesting Story解释代码D1. Domino (easy version)解释代码D2. Domino (hard version)解释代码E. Fixed Points解释代码F. Equidistant Vertices解释代码A. Poly原创 2021-07-25 18:33:48 · 136 阅读 · 0 评论 -
Codeforces Round #713 (Div. 3) A~G
文章目录ABCDEFG埃斯筛欧拉筛A标记遍历。#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);#include<bits/stdc++.h>#define int long longusing namespace std;typedef pair<int,int> pii;typedef long long ll;const int INF = 0x3f3f3f3f;const dou原创 2021-04-13 23:53:22 · 160 阅读 · 0 评论 -
Codeforces Round #697 (Div. 3)
A:偶数因子一定能被2整除,直接能被2整除就除2.最后判断是不是等于1.#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);#include<bits/stdc++.h>#define int long longusing namespace std;typedef pair<int,int> pii;const int INF = 0x3f3f3f3f;const double eps = 1原创 2021-01-28 21:25:28 · 64 阅读 · 0 评论 -
Codeforces Round #696 (Div. 2) A~D
A: 贪心。考虑dd的上一个为2: 当前s为1,则保持当前为1.否则为0,则加1.d的上一个为1: 当前s为1,则加1,否则为0,保持当前的结果。d的上一个为0: 都加1#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);#include<bits/stdc++.h>#define int long longusing namespace std;typedef pair<int,int> pi原创 2021-01-25 21:12:48 · 64 阅读 · 0 评论 -
Educational Codeforces Round 102 (Rated for Div. 2)A~D
A: 选出最少的两个,判断是否之和小于等于d 或者全部都小于d就行了。#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);#include<bits/stdc++.h>#define int long longusing namespace std;typedef pair<int,int> pii;typedef long long ll;const int INF = 0x3f3f3f3f;原创 2021-01-25 00:08:49 · 70 阅读 · 1 评论 -
Codeforces Round #686 (Div. 3)
A: 错一位输出#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);#include<bits/stdc++.h>#define int long longusing namespace std;typedef pair<int,int> pii;typedef long long ll; const int INF = 0x3f3f3f3f;const double eps = 1e-5;原创 2020-12-11 19:44:26 · 71 阅读 · 0 评论 -
Codeforces Round #685 (Div. 2)A~E2
A:让数变成2的倍数,如果不是,则减1,之后都变成2来操作#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);#include<bits/stdc++.h>#define int long longusing namespace std;typedef pair<int,int> pii;typedef long long ll; const int INF = 0x3f3f3f3f;con原创 2020-11-22 23:17:31 · 91 阅读 · 0 评论 -
Educational Codeforces Round 98 (Rated for Div. 2) A ~D
A:交错走,当x==y则直接走x + y 否则走 2*max(x,y)-1.#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);#include<bits/stdc++.h>#define int long longusing namespace std;typedef pair<int,int> pii;typedef long long ll; const int INF = 0x3f3f原创 2020-11-20 22:50:46 · 106 阅读 · 0 评论 -
Codeforces Round #669 (Div. 2) A ~ D
A:判断1和0的个数,1的个数为cnt如果1大于0的个数,则输出 cnt%2 == 0?cnt:cnt-1 个1否则输出所有个数的0就可以。#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);#include<iostream>#include<algorithm>#include<cstring>#include<cmath>#include<queue>原创 2020-09-09 20:24:50 · 97 阅读 · 0 评论 -
Codeforces Round #660 (Div. 2) D
由题可以构造出一个有向路径,对于一个路径,只要我们从起点开始走,我们就可以尽可能的得到最大的值。若前面一个是负数,则我们把它最后选取最为合适,因为这样继续跟着这条路径选下去,会导致后面的数越变越小。直接拓扑排序正数存到res1,负数存到res2.对于res2,为了自己的贪心成立,对于每一个负数,可能会有它前面的一个点是它的父父父结点,我们不能让这种情况发生,因为发生了,这个数还会变的更小,所以我们直接逆序输出即可。代码:#define IOS ios::sync_with_stdio(false)原创 2020-08-29 22:15:23 · 80 阅读 · 0 评论 -
Codeforces Round #664 (Div. 2) A~D
A:回文满足条件就是最多只有一个是奇数。题上的操作可以把每一个数的奇偶性翻转。直接特殊判断一下就可。代码:#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);#include<iostream>#include<algorithm>#include<cstring>#include<map>#define int long long#define sc scanf原创 2020-08-26 17:13:55 · 71 阅读 · 0 评论 -
Codeforces Round #662 (Div. 2)
A:第一次操作把最外环处理,结下来每次操作会把一个环处理完,并且向里面的一个环处理。可以的出为n/2+1;#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);#include<bits/stdc++.h>#define int long long#define sc scanf#define pf printfusing namespace std;typedef pair<int,int>原创 2020-08-25 13:43:21 · 118 阅读 · 0 评论 -
Educational Codeforces Round 93 (Rated for Div. 2)A~D
A:a[1] + a[2] > a[n] 最小的两个加起来都比第三边大,则-1.#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);#include<iostream>#include<algorithm>#include<cstring>#define int long long#define sc scanf#define pf printfusing namespace原创 2020-08-25 00:28:49 · 66 阅读 · 0 评论 -
Codeforces Round #665 (Div. 2) A~D
A:特判情况,当n是<=k 的时候,都可以把让B为0点,A为n点。否则:当k时奇数的时候,AB,OB的距离差会构成全为奇数的长度。反之为偶数。#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);#include<iostream>#include<algorithm>#define int long long#define sc scanf#define pf printfusing原创 2020-08-24 14:21:29 · 150 阅读 · 0 评论 -
codeforces 660 div2 C
题意: 给你一个图(树),让你判断每个城市的的幸福值是否正确。幸福值计算为 h = good - bad 开心的减去不开心的。好心情的人可以变坏,但是坏心情的人就不能变好,在城市内不能变化。对于每一个城市,我们可以知道:happy_man + bad_man = total_number(总经过的人)happy_man - bad_man = h(幸福值)化简得 happy_man = (total_number + h) / 2, bad_man = (total_number-happy_m原创 2020-07-31 23:49:03 · 117 阅读 · 0 评论 -
Codeforces Round #655 (Div. 2) D
题意就是 选出(n+1)/2 个点且只有两个点相邻并计算出它们的和 ,求出最大值。对于 2 1 3 7 8 这个序列 假设以第一个点开始选,就会有 238 237 217但是不会有 213 128 因它们是连续的3个 再最后合成的时候,必定会损失1个。对于一个序列,我们去任意一个为开头隔空选取,最后一定会存在,两个点相邻的情况,且相邻的两个点是开头和开头前一个比如上述 , 238 就是以 2开始选,237就是以3开始所以可以得到,最后和成的值为 S(以i为开始点,往后隔空选取最后取到a[原创 2020-07-14 22:21:12 · 122 阅读 · 0 评论