Codeforces Round #632 (Div. 2) 题解】的更多相关文章

空山新雨后,天气晚来秋. 明月松间照,清泉石上流. 竹喧归浣女,莲动下渔舟. 随意春芳歇,王孙自可留.--王维 A. Little Artem 网址:https://codeforces.com/contest/1333/problem/A Young boy Artem tries to paint a picture, and he asks his mother Medina to help him. Medina is very busy, that's why she asked fo…
Codeforces Round #632 (Div. 2) 这一场打的好差呀,这几次艰难上的分全部掉回去了,感觉就像一夜回到了解放前. 说实话,就是被B卡到了,没看到只能从小的放到大的... Little Artem 这个构造就是只让最后一行的最后一个是W就行了,其余都设置成B. #include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn=1e5+10; int main(){ int t…
Codeforces Round #182 (Div. 1)题解 A题:Yaroslav and Sequence1 题意: 给你\(2*n+1\)个元素,你每次可以进行无数种操作,每次操作必须选择其中n个元素改变符号,你的目的是使得最后所有数的和尽量大,问你答案是多少 题解: 感觉上就是构造题,手动玩一玩就知道,当n为奇数的时候,你可以通过三次操作,使得只会改变一个负数的符号.同理n为偶数的时候,每次要改变两个负数的符号. 所以答案如下: 当n为奇数的时候,答案为所有数的绝对值和 当n为偶数的…
目录 Codeforces Round #608 (Div. 2) 题解 前言 A. Suits 题意 做法 程序 B. Blocks 题意 做法 程序 C. Shawarma Tent 题意 做法 程序 D. Portals 题意 做法 程序 E. Common Number 题意 做法 程序 结束语 Codeforces Round #608 (Div. 2) 题解 前言 题目链接:仅仅只是为了方便以题目作为关键字能查找到我的题解而已(逃 Codeforces 1271A Codeforce…
Codeforces Round #525 (Div. 2)题解 题解 CF1088A [Ehab and another construction problem] 依据题意枚举即可 # include <bits/stdc++.h> int main() { int x; scanf("%d", &x); for(int i = 1; i <= x; i++) for(int j = 1; j <= x; j++) if((i % j == 0) &…
Codeforces Round #528 (Div. 2)题解 A. Right-Left Cipher 很明显这道题按题意逆序解码即可 Code: # include <bits/stdc++.h> int main() { std::string s, t; std::cin >> s; int len = s.length(); int cnt = 0; for(int i = 0; i < len; i++) { t = t + s[((len + 1) / 2 +…
Codeforces Round #466 (Div. 2) 题解 A.Points on the line 题目大意: 给你一个数列,定义数列的权值为最大值减去最小值,问最少删除几个数,使得数列的权值小于等于给定值d 题解: 排序,每次挑最大的和最小的,看看最小的能跟多少个数差\(>d\),看看最大的能跟多少个数差\(>d\),取个数大的那个删除.复杂度\(n^2 + n\log n\) 代码 #include <iostream> #include <cstdio>…
Codeforces Round #677 (Div. 3) 题解 A. Boring Apartments 题目 题解 简单签到题,直接数,小于这个数的\(+10\). 代码 #include <bits/stdc++.h> using namespace std; #define ll long long #define IOS ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0); const int maxn = 2e5 + 10;…
Codeforces Round #665 (Div. 2) 题解 写得有点晚了,估计都官方题解看完切掉了,没人看我的了qaq. 目录 Codeforces Round #665 (Div. 2) 题解 A - Distance and Axis B - Ternary Sequence C - Mere Array D - Maximum Distributed Tree E - Divide Square F - Reverse and Swap A - Distance and Axis…
Codeforces Round #160 (Div. 1) A - Maxim and Discounts 题意 给你n个折扣,m个物品,每个折扣都可以使用无限次,每次你使用第i个折扣的时候,你必须买q[i]个东西,然后他会送你{0,1,2}个物品,但是送的物品必须比你买的最便宜的物品还便宜,问你最少花多少钱,买完m个物品 题解 显然我选择q[i]最小的去买就好了 代码 #include<bits/stdc++.h> using namespace std; const int maxn =…
Codeforces Round #383 (Div. 2) A. Arpa's hard exam and Mehrdad's naive cheat 题意 求1378^n mod 10 题解 直接快速幂 代码 #include<bits/stdc++.h> using namespace std; long long quickpow(long long m,long long n,long long k) { long long b = 1; while (n > 0) { if…
Codeforces Round #271 (Div. 2) A - Keyboard 题意 给你一个字符串,问你这个字符串在键盘的位置往左边挪一位,或者往右边挪一位字符,这个字符串是什么样子 题解 模拟一下就好了 代码 #include<bits/stdc++.h> using namespace std; string s[3]; map<char,int>r,c; char ss[2][107]; int main() { s[0]="qwertyuiop"…
Codeforces Round #177 (Div. 1) A. Polo the Penguin and Strings 题意 让你构造一个长度为n的串,且里面恰好包含k个不同字符,让你构造的字符串字典序最小. 题解 先abababab,然后再把k个不同字符输出,那么这样就是最少 代码 #include<bits/stdc++.h> using namespace std; string s; int main() { int n,k; scanf("%d%d",&am…
Codeforces Round #547 (Div. 3) 题目链接:https://codeforces.com/contest/1141 A,B咕咕了... C. Polycarp Restores Permutation 题意: 有一个n的排列,但现在只给出相邻两位的差,问原排列是多少,如果不存在就输出-1. 题解: 通过相邻两位的差我们可以知道第一个元素和其它位置元素的大小关系,然后根据这个来搞一波就行了. 代码如下: #include <bits/stdc++.h> using n…
Codeforces Round #546 (Div. 2) 题目链接:https://codeforces.com/contest/1136 A. Nastya Is Reading a Book 题意: 一本书有n个章节,之后给出每个章节所在页数范围,然后有一个人来看书看了k页,问还有多少章节没看. 题解: 水题.模拟一下就好了. #include <bits/stdc++.h> using namespace std; typedef long long ll; ; int n; int…
Codeforces Round #544 (Div. 3) D. Zero Quantity Maximization 题目链接:https://codeforces.com/contest/1133/problem/D 题意: 给出ai,bi,然后让你确定一个数d,令ci=d*ai+bi,问怎么确定这个d,有最多的ci为0. 题解: 这个题其实不难,但是我没做起,哎,初中数学没学好啊..其实做法就是map+pair就行了. 但是这里要注意一个问题,就是当ai=bi=0的时候,d是可以任意取值…
Codeforces Round #539 (Div. 2) 题目链接:https://codeforces.com/contest/1113 A. Sasha and His Trip 题意: n个城市,城市分布在一条直线上且按升序排序,现在有个人开车从一号城市出发,车的油箱容量为v. 在每个城市都可以买油,但价格不一样:第i个城市买1单位的油花费i元.问最终从1到n花费的最少为多少. 题解: 贪心即可,尽量在前面的城市买油,最后一鼓作气到n号城市. 代码如下: #include <bits/…
Codeforces Round #535 (Div. 3) 题目总链接:https://codeforces.com/contest/1108 太懒了啊~好久之前的我现在才更新,赶紧补上吧,不能漏掉了. A. Two distinct points 题意: 给出两个区间的左右边界,输出两个数,满足两个数分别在两个区间内且这两个数不相等. 题解: 直接输出左端点然后判断一下就行了. 代码如下: #include <bits/stdc++.h> using namespace std; type…
Codeforces Round #506 (Div. 3) 题目总链接:https://codeforces.com/contest/1029 A. Many Equal Substrings 题意: 给出长度为n的字符串,然后要求你添加一些字符,使得有k个这样的字符串. 题解: 直接暴力吧...一个指针从1开始,另一个从2开始,逐一比较看是否相同:如果不同,第一个指针继续回到1,第二个指针从3开始...就这么一直重复.最后如果第二个指针能够顺利到最后一位,那么记录当前的第一个指针,把他后面的…
Codeforces Round #532 (Div. 2) 题目总链接:https://codeforces.com/contest/1100 A. Roman and Browser 题意: 给出由-1和1组成的n个数,现在任意选定一个起点,从起点开始向左向右k个k个地拿走.最后问abs(cnt(-1)-cnt(1))最大是多少. 题解: 由于n和k最多只有100,所以枚举起点直接暴力就好了. 代码如下: #include <bits/stdc++.h> using namespace s…
link orz olinr AK Codeforces Round #533 (Div. 2) 中文水平和英文水平都太渣..翻译不准确见谅 T1.给定n<=1000个整数,你需要钦定一个值t,使得每个整数到线段[t-1,t+1]距离和最小,求最小距离,每个数<=100 枚举t #include <cstdio> using namespace std; int n, a[1010]; int main() { scanf("%d", &n); for…
Codeforces Round #277 (Div. 2) A. Calculating Function time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output For a positive integer n let's define a function f: f(n) =  - 1 + 2 - 3 + .. + ( - 1)n…
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…
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.…
A. Friends Meeting time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Two friends are on the coordinate axis Ox in points with integer coordinates. One of them is in the point x1 = a, another…
第一次打Div 1,感觉还是挺难的..把基础题打完就日常划水了.... [A. Arpa's loud Owf and Mehrdad's evil plan](http://codeforces.com/problemset/problem/741/A) 题目大意: 有n个人,每个人有一个后继,求在进行多少次传递后第i 个人跟第j个人对话的同时,第j个人也能跟第i个人对话(允许自己与自己对话).$1\leq n \leq 100$ 这题意花了我好多时间啊..说白了就是要找环咯,把每条环求出来然…
题目链接:http://codeforces.com/contest/839 A. Arya and Bran 题意:每天给你一点糖果,如果大于8个,就只能给8个,剩下的可以存起来,小于8个就可以全部给完 解法:水题,按照题意模拟一下即可. #include <bits/stdc++.h> using namespace std; int n, k, a[110]; int main() { cin>>n>>k; int s = 0; for(int i=1; i<…
[前言]咦?如今怎么流行打CF了?于是当一帮大爷在执着的打div 1的时候,我偷偷的在刷div 2.至于怎么决定场次嘛.一般我报一个数字A,随便再拉一个人选一个数字B.然后開始做第A^B场.假设认为机密性不高,来点取模吧. 然后今天做的这场少有的AK了.(事实上模拟赛仅仅做完了4题.最后1题来不及打了) 等等.话说前面几题不用写题解了?算了,让我难得风光一下啦. [A] A. Polo the Penguin and Segments time limit per test 2 seconds…
Problem A: 题目大意: 给定两个数列\(a,b\),一次操作可以交换分别\(a,b\)数列中的任意一对数.求最少的交换次数使得任意一个数都在两个序列中出现相同的次数. (\(1 \leq a_i,b_i \leq 5 , 1 \leq n \leq 100\)) 题解: 直觉告诉我这么搞就行了 #include <cstdio> #include <cstring> #include <algorithm> using namespace std; typed…
Problem A 题目大意 给定两个字符串,要求构造出一个最长的一个串满足:这个串是其中一个串的字序列并且不是另一个串的子序列.输出长度.\((len \leq 10^5)\) 题解 千万年死在读题上 我做题的时候:哇!这不是一道SB题嘛? 2mins敲完,提交Wrong answer 我去,好像看错题了..我说怎么这道题这么二... 我重新看了眼题.. 那这题不更SB了吗?????? 一边怀疑自己一边提交了上去,结果Accepted了.. 我去,判个字符串是否相等,再输出长度最大值就可以了…