Codeforces Round #527 (Div. 3) 题解 题目总链接:https://codeforces.com/contest/1092 A. Uniform String 题意: 输入n,k,n表示字符串的长度,k表示从1-k的小写字符(1即是a),现在要求最大化最少字符的数量. 题解: 贪心搞一搞就行了. 代码如下: #include <bits/stdc++.h> using namespace std; int T; int n,k; int main(){ cin>…
题目传送门 /* 题意:找到一个字符串p,使得它和s,t的不同的总个数相同 贪心:假设p与s相同,奇偶变换赋值,当是偶数,则有答案 */ #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> #include <iostream> using namespace std; ; const int INF = 0x3f3f3f3f; int p[MAXN…
#include<bits/stdc++.h>using namespace std;const int maxn=1e6+7;pair<string,int>p[maxn];int nn,n;int cmp(pair<string,int>a,pair<string,int>b){    return a.first.length()<b.first.length();}char ans[maxn];multiset<string>sst…
题目连接:http://codeforces.com/contest/676/problem/C 题意:一串字符串,最多改变k次,求最大的相同子串 题解:很明显直接尺取法 #include<cstdio> #include<cstring> #include<cmath> #include<string> #include<set> #include<map> #include<vector> #include<qu…
B. Equidistant String Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/545/problem/B Description Little Susie loves strings. Today she calculates distances between them. As Susie is a small girl after all, her strings conta…
[Link]:http://codeforces.com/contest/828/problem/C [Description] 让你猜一个字符串原来是什么; 你知道这个字符串的n个子串; 且知道第i个字符t[i],在k[i]个位置出现过; 且告诉你这k[i]个位置在哪里; 数据不会产生矛盾; 让你输出最终的字符串,输出字典序最小的那个; [Solution] 对于输入的n个子串; 对于每个位置; 看看那个位置有没有子串之前出现过,没有的话,就放在那个位置; 否则,如果当前这个子串ti的长度比原…
链接: https://codeforces.com/contest/1265/problem/A 题意: A string is called beautiful if no two consecutive characters are equal. For example, "ababcb", "a" and "abab" are beautiful strings, while "aaaaaa", "abaa&…
题目链接:https://codeforces.com/contest/1385/problem/D 题意 一个小写字母串称为 $c-good\ string$,如果至少满足以下条件之一: 字符串长度为 $1$,包含字母 $c$ 字符串前一半都为字母 $c$,后一半为 $(c+1)-good\ string$ 字符串后一半都为字母 $c$,前一半为 $(c+1)-good\ string$ 计算将一个长为 $n = 2^k$ 的小写字母串变为 $a-good\ string$ 至少需要替换多少个…
题目链接:https://codeforces.com/contest/1265/problem/A 题意 给出一个由 a, b, c, ? 组成的字符串,将 ? 替换为 a, b, c 中的一个字母,问能否字符串中所有相邻字母都不同. 题解 除非一开始字符串就不合法,否则一定可以构造出合法的字符串,因为共有三个字母可选,而替换时最多需要判断前后两个位置. 代码 #include <bits/stdc++.h> using namespace std; void solve() { strin…
题目链接 题意:给你一个长度n,还有2*n-2个字符串,长度相同的字符串一个数前缀一个是后缀,让你把每个串标一下是前缀还是后缀,输出任意解即可. 思路;因为不知道前缀还是后缀所以只能搜,但可以肯定的是长度为n-1的字符串一个是前缀一个是后缀,那么只要搜两次就完事了,一个当前缀不行就换另一个当前缀,然后中间判断一下即可. ps:这也是给远古题,没补,因为最不喜欢 字符串的题,,,qwq. #include<bits/stdc++.h> #define LL long long #define f…