题意: 给你 n 长全排列的一种情况,将其分为 k 份,取每份中的最大值相加,输出和的最大值和有多少种分法等于最大值. 思路: 取前 k 大值,储存下标,每两个 k 大值间有 vi+1 - vi 种分法,相乘即可. #include <bits/stdc++.h> using namespace std; typedef long long ll; const ll mod=998244353; int main() { int n,k;cin>>n>>k; int p…
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 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 (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…
A. Bad Ugly Numbers 思路 题意: 给我们一个k,让我们用 0-9 之间的数字构成一个 k位数a,a不能被组成a的每一位数字整除. 分析:首先 k等于1,无论我们怎么配都会被整除:当k > 1 的时候,a的组成位数中肯定不能有1,那么只能在 2-9,之间选择,剩下我们可以选择两个不能互相整除的数如 2.7,,我们可以让2作为第一位,剩下的位数全是7,,,,例如我们求一个k = 3 时我们构成的数a,a = 277 代码 #include<iostream> #inclu…