题面: 传送门 题目描述: 题意:确定最大的x,使去除掉前x天的其中一天后,所有不同数字的数量相等.   题目分析: 可能是我太久没打cf了,水题都做不出来. 这道题的关键在于:要记录相同数量,的不同数字,有多少个.为什么要这样记录呢?我们分析一下符合题意的有多少种情况: 1.每个不同的数字只出现1次,例:1,2,3,4,5 2.只有一种数字,例:1,1,1,1,1 3.只有一种数字出现1次,其他数字出现的次数相同,例:1,1,1,2,2,2,3 4.有一种数字出现的次数比其他数字都多出1次,例…
目录 Codeforces Round #558 (Div. 2) 题解 A Eating Soup B Cat Party C Power Transmission D Mysterious Code E Magical Permutation Codeforces Round #558 (Div. 2) 题解 A Eating Soup 分类讨论一下 \(m\) 个断点最多可以将环分成 \(m\) 段,而剩下 \(n-m\) 个点最多可以成为 \(n-m\) 段,取个 \(\min\) 即可…
http://codeforces.com/problemset/problem/1163/B2 题意:有n天,每天有一个颜色,截取前x天,随便抽掉一天,使剩下的各个颜色出现的次数相等. 解题,也可以解决B1: 有三种情况: 1.一种颜色出项一次,其他相等,抽掉出现1次颜色的那一天,例如13天分别是 6 222 333 444 555 2.只有两种颜色次数,次数相差1,并且最大出现次数的颜色只有1次,例如13天分别是 777 333 222 8888 3.所有颜色都只出现过1次,例如 1 2 3…
这场比赛没有打,后来和同学们一起开了场镜像打…… B是SB题结果WA了5发…… C是SB题结果差5min调出……虽然中间有个老师讲题吃掉了1h D是比较神仙的题(2200),但是做出来了?算是比较超常发挥了.(平常能做出的题中最难的就是2200了) E是2800,F是2900,zblzbl…… 这次发挥还是不错的,写一篇题解吧. A 首先发现在一个圆上删掉 $m$ 个点,段数的上界为 $m$.($0$ 除外,所以要特判 $0$) 然后剩下了 $n-m$ 个点.答案就是 $\min(m,n-m)$…
#include<bits/stdc++.h>using namespace std;int a[100007];int cnt[100007];int main(){    int n;    scanf("%d",&n);    for(int i=1;i<=n;i++)     scanf("%d",&a[i]); int ans=1; set<int>s,num;//数字出现的次数,数字 map<int,i…
#include<bits/stdc++.h>using namespace std;typedef struct{ double k,b;}node;node k[1000007];bool cmp(node&a,node&b){ if(a.k==b.k)  return a.b<b.b; return a.k<b.k;}long long x[1007],y[1007];int main(){ long long n,ans=0,tot=0; scanf(&qu…
B. Problems for Round 题目连接: http://www.codeforces.com/contest/673/problem/B Description There are n problems prepared for the next Codeforces round. They are arranged in ascending order by their difficulty, and no two problems have the same difficult…
B. Problems for Round time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output There are n problems prepared for the next Codeforces round. They are arranged in ascending order by their difficulty,…
连接在这里,->点击<- A. Bear and Game time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Bear Limak likes watching sports on TV. He is going to watch a game today. The game lasts 90 minutes and ther…
[Educational Codeforces Round 16]D. Two Arithmetic Progressions 试题描述 You are given two arithmetic progressions: a1k + b1 and a2l + b2. Find the number of integers x such that L ≤ x ≤ R andx = a1k' + b1 = a2l' + b2, for some integers k', l' ≥ 0. 输入 Th…
D. Mahmoud and a Dictionary time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Mahmoud wants to write a new dictionary that contains n words and relations between them. There are two types of…
Codeforces Round #552 (Div. 3) 题目链接 A. Restoring Three Numbers 给出 \(a+b\),\(b+c\),\(a+c\) 以及 \(a+b+c\) 这四个数,输出一种合法的 \(a,b,c\).   可以发现,前面的两个数加起来减去最后的 \(a+b+c\),答案就出来一个.最后这样求出\(a,b,c\)即可. 代码如下: Code #include <bits/stdc++.h> using namespace std; typede…
A. Mahmoud and Longest Uncommon Subsequence time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest comm…
A. Mahmoud and Longest Uncommon Subsequence time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest comm…
Educational Codeforces Round 48 (Rated for Div. 2) C. Vasya And The Mushrooms 题目链接:https://codeforces.com/contest/1016/problem/C 题意: emmm,说不清楚,还是直接看题目吧. 题解: 这个题人行走的方式是有一定的规律的,最后都是直接走到底,然后从另外一行走回来.并且通过画图观察,会发现他走到格子的时间会有一定的规律. 所以就维护几个前缀和就行了,从1到n枚举一下,还要…
地址:http://codeforces.com/contest/766/problem/D 题目: D. Mahmoud and a Dictionary time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Mahmoud wants to write a new dictionary that contains n words…
题目链接:Codeforces Round #298 (Div. 2) A. Exam An exam for n students will take place in a long and narrow room, so the students will sit in a line in some order. The teacher suspects that students with adjacent numbers (i and i + 1) always studied side…
Mahmoud wants to write a new dictionary that contains n words and relations between them. There are two types of relations: synonymy (i. e. the two words mean the same) and antonymy (i. e. the two words mean the opposite). From time to time he discov…
B. Jamie and Binary Sequence (changed after round) time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Jamie is preparing a Codeforces round. He has got an idea for a problem, but does not kno…
Codeforces Round #272 (Div. 2) A. Dreamoon and Stairs time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Dreamoon wants to climb up a stair of n steps. He can climb 1 or 2 steps at each move.…
Codeforces Round #578 (Div. 2) 传送门 A. Hotelier 暴力即可. Code #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 2e5 + 5; int n; char s[N]; int res[10]; int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n;…
Beautiful Regional Contest 题意 题解 代码 Beautiful Sequence 题意 题解 代码 一个思路不够清晰的代码 Beautiful Mirrors with queries 题意 题解 代码 Beautiful Regional Contest 题目链接 http://codeforces.com/contest/1264/problem/A 题意 给出区域赛中 N 支队伍做出的题数,在一定规则下发奖时,金银铜牌奖牌数总和的最大值. 要求: 合法方案中每种…
A - Forgetting Things 题意:给 \(a,b\) 两个数字的开头数字(1~9),求使得等式 \(a=b-1\) 成立的一组 \(a,b\) ,无解输出-1. 题解:很显然只有 \(a=b\) 和 \(a=b-1\) 的时候有解,再加上一个从 \(9\) 越到 \(10\) 的就可以了.被样例的 \(199,200\) 误导了. #include<bits/stdc++.h> using namespace std; typedef long long ll; int mai…
Codeforces Round #590 (Div. 3) Editorial 题目链接 官方题解 不要因为走得太远,就忘记为什么出发! Problem A 题目大意:商店有n件商品,每件商品有不同的价格,找出一个最小的可能值price,使得price * n >= sum,sum指的是原来商品价格的总和. 知识点:模拟 思路:求出sum/n向上取整即可,有两种方法.一是使用ceil()函数,但注意ceil()返回的是向上取整后的浮点数,所以要进行强制类型转换:二是直接向下取整,然后用if语句…
Codeforces Round #572 (Div. 1) A2 题意:给一棵树,带边权,互不相同且为偶数.每次操作是选两个叶子然后在路径上同时加一个数.初始边权全是0,求一个操作序列使得最终边权与给定边权相同. \(n \le 1000\) ,构造的序列长度不超过 \(10^5\) key:构造 首先,如果有二度点,那么一定无解. 所以现在每个点要不是叶子,要不就至少是三度.考虑一条边,我们只把它的边权改变,而不改变其他边.此时需要讨论这条边两段的点的度数. 如果两个点都是大于等于三度的,那…
Codeforces Round #789 (Div. 2) A-C A 题目 https://codeforces.com/problemset/problem/1677/A 题解 思路 知识点:模拟. (比较显然,不写了) 时间复杂度 \(O(nlogn)\) 空间复杂度 \(O(n)\) 代码 #include <bits/stdc++.h> using namespace std; int a[100]; int main(){ std::ios::sync_with_stdio(0)…
Codeforces Round #734 (Div. 3) 20210920.网址:https://codeforces.com/contest/1551. 编程细节:下标定义不要一会[1,n]一会[0,n)啊- A 用价值为1的硬币a枚+价值为2的硬币b枚,买价值为n的东西,希望ab之差的绝对值尽量小.大水题. B1 给我们一个字符串s,用红色和绿色给s上色,规则如下: 一个字母或者不上色,或者被涂成一种颜色,即不能又红又绿. 被涂成一种颜色的所有字母,必须两两不相同. 红色字母数量=绿色字…
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate it n = int(raw_input()) s = "" a = ["I hate that ","I love that ", "I hate it","I love it"] for i in ran…
Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/output 1 s, 256 MB    x3384 B Pyramid of Glasses standard input/output 1 s, 256 MB    x1462 C Vasya and String standard input/output 1 s, 256 MB    x1393…
直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输出”#Color”,如果只有”G”,”B”,”W”就输出”#Black&White”. #include <cstdio> #include <cstring> using namespace std; const int maxn = 200; const int INF =…