#define HAVE_STRUCT_TIMESPEC#include<bits/stdc++.h>using namespace std;int main(){ ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n;//因为满足题意的数的最右下方结点最大且与根节点奇偶性相同,所以树的右子树一定有偶数个结点,左子树可以有和右子树一样多的结点,也可以多一个结点 cin>>n; int x=1; while…
Codeforces Global Round 3 A. Another One Bites The Dust 有若干个a,有若干个b,有若干个ab.你现在要把这些串拼成一个串,使得任意两个相邻的位置都是不同字符,求可能的最长串长度. 枚举一下\(a\)开头还是\(b\)开头,那么接下来就被唯一确定了. #include<iostream> #include<cstdio> using namespace std; int a,b,c;long long ans; int main…
CodeForces Global Round 1 CF新的比赛呢(虽然没啥区别)!这种报名的人多的比赛涨分是真的快.... 所以就写下题解吧. A. Parity 太简单了,随便模拟一下就完了. B. Tape 显然就是先找一个长的把所有的全部覆盖,然后可以在上面丢掉\(k-1\)段间隙. 那么把两两之间的间隙长度拿出来排序就可以了. C. Meaningless Operations 如果\(a\)不等于\(2^k-1\)的形式,那么令\(S=2^k-1\),其中\(2^{k-1}<a<2…
Problem   Codeforces Global Round 1 - D. Jongmah Time Limit: 3000 mSec Problem Description Input Output Print one integer: the maximum number of triples you can form. Sample Input 10 62 3 3 3 4 4 4 5 5 6 Sample Output 3 题解:动态规划,对这种状态定义不熟悉,主要还是没有发现最优方…
Codeforces Global Round 2 题目链接:https://codeforces.com/contest/1119 A. Ilya and a Colorful Walk 题意: 给出n个数,问从一个数到另外一个不同数的最长距离是多少. 题解: 从前往后,从后往前扫两遍即可.证明可用反证法,这里略去. #include <bits/stdc++.h> using namespace std; typedef long long ll; ; int n; int c[N]; i…
Codeforces Global Round 1 题目链接:https://codeforces.com/contest/1110 A. Parity 题意: 给出{ak},b,k,判断a1*b^(k-1)+a2*b^(k-2)+...+ak*b^0的奇偶性. 题解: 暴力求模2意义下的值就好了. 代码如下: #include <bits/stdc++.h> using namespace std; typedef long long ll; ; int n; int b,k; int a[…
Codeforces Global Round 1 (CF1110) 继续补题.因为看见同学打了这场,而且涨分还不错,所以觉得这套题目可能会比较有意思. 因为下午要开学了,所以恐怕暂时不能把这套题目补完了,所以先把 A-F 放上来. A. Parity 保存 %2 的值就可以了. const int N = 1e5 + 7; int b, k, a[N], ans; int main() { read(b), read(k); for (int i = 1; i <= k; ++i) read(…
[手抖康复训练1 ]Codeforces Global Round 6 总结:不想复习随意打的一场,比赛开始就是熟悉的N分钟进不去时间,2333,太久没写题的后果就是:A 题手抖过不了样例 B题秒出思路手抖过不了样例,C题秒出思路手抖过不了样例*3 D题 手抖 过的了样例 ,调了1h,赛后发现变量名写错了,改一个字符就能AC... 题目等补完题一起放上来QAQ…
Codeforces Global Round 11 1427A. Avoiding Zero 题目链接:click here 待补 1427B. Chess Cheater 题目链接:click here Example input 8 5 2 WLWLL 6 5 LLLWWL 7 1 LWLWLWL 15 5 WWWLLLWWWLLLWWW 40 7 LLWLWLWWWLWLLWLWWWLWLLWLLWLLLLWLLWWWLWWL 1 0 L 1 1 L 6 1 WLLWLW output…
题目链接:https://codeforces.com/contest/1368/problem/B 题意 构造最短的至少含有 $k$ 个 $codeforces$ 子序列的字符串. 题解 如下表:   c o d e f o r c e s 子序列个数 个数 1 1 1 1 1 1 1 1 1 1 $1^{10}$   2 2 2 2 2 2 2 2 2 2 $2^{10}$   3 3 3 3 3 3 3 3 3 3 $3^{10}$ 依次构造每个字符的个数即可. 证明   c o d e…