Educational Codeforces round 78 A、B】的更多相关文章

链接:https://codeforces.com/contest/1278 A:Shuffle Hashing 题意:对于一个字符串p可以执行一个"hash"操作,首先将p内的元素随机排列(可能保持原样),随后在p的前面和后面分别加两个字符串(可以为空),组成的新字符串称为h.输入字符串p和h,输出h是否可能是p经过hash操作而来. 例如:输入p = "abacaba",h = "zyxaabcaabkjh",输出YES 分析:hash操作分…
http://codeforces.com/contest/961 B题 可以将长度为k的连续区间转化成1 求最大和 解析 简单尺取 #include <stdio.h> #include <math.h> #include <string.h> #include <stdlib.h> #include <iostream> #include <sstream> #include <algorithm> #include…
链接: https://codeforces.com/contest/1278/problem/D 题意: As the name of the task implies, you are asked to do some work with segments and trees. Recall that a tree is a connected undirected graph such that there is exactly one simple path between every…
链接: https://codeforces.com/contest/1278/problem/C 题意: Karlsson has recently discovered a huge stock of berry jam jars in the basement of the house. More specifically, there were 2n jars of strawberry and blueberry jam. All the 2n jars are arranged in…
链接: https://codeforces.com/contest/1278/problem/B 题意: You are given two integers a and b. You can perform a sequence of operations: during the first operation you choose one of these numbers and increase it by 1; during the second operation you choos…
链接: https://codeforces.com/contest/1278/problem/A 题意: Polycarp has built his own web service. Being a modern web service it includes login feature. And that always implies password security problems. Polycarp decided to store the hash of the password…
比赛传送门 A. Shuffle Hashing 题意:加密字符串.可以把字符串的字母打乱后再从前面以及后面接上字符串.问加密后的字符串是否符合加密规则. 题解:字符串的长度很短,直接暴力搜索所有情况 // https://codeforces.com/contest/1278/problem/A #include<iostream> #include<cstdio> #include<cstring> using namespace std; int T; char…
题:https://codeforces.com/contest/1278/problem/B 思路:还是把1~n分配给俩个数,让他们最终相等 假设刚开始两个数字相等,然后一个数字向前走了abs(b-a)步,由等差数列求和公式,这时候我们贪心的让另外一个数字走大于等于abs(b - a)的最小步数,然后如果两数相等必须满足走的步数之和%2=0 #include<bits/stdc++.h> using namespace std; #define pb push_back typedef lo…
A. Johny Likes Numbers time limit per test 0.5 seconds memory limit per test 256 megabytes input standard input output standard output Johny likes numbers n and k very much. Now Johny wants to find the smallest integer x greater than n, so it is divi…
A题 给出n对串,求s1,是否为s2一段连续子串的重排,串长度只有100,从第一个字符开始枚举,sort之后比较一遍就可以了: char s1[200],s2[200],s3[200]; int main() { int q; cin >> q; while(q--) { cin >> s1 >> s2; int s11 = strlen(s1),s22 = strlen(s2),i; sort(s1,s1+s11); s3[s11] = '\0'; for(i = 0…