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 #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 #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 #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 #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 #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 #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…
题目链接: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…