题解 CF1216A 【Prefixes】】的更多相关文章

题目大意:给你一个长度为$n$($n$为偶数)的字符串,且这个字符串仅由$'a'$与$'b'$两种字符组成,要你用最少的操作次数使得 $s[i]!=s[i-1] (i/2=0,1≤i≤n)$(若字符串从1开始),并输出更改后的串 大水题?两个两个一跳,相等就把其中一个换一下. 上代码: #include<cstdio> inline int read(){ int r=0,f=1; char c=getchar(); while(c<'0'||c>'9'){if(c=='-')f=…
contesthunter暑假NOIP模拟赛#1题解: 第一题:杯具大派送 水题.枚举A,B的公约数即可. #include <algorithm> #include <cmath> #include <iostream> using namespace std; #define MAXN 100010 struct node { int a,b,c; }ans[MAXN]; int main() { int R, G; scanf("%d%d",&…
做的太糟糕了...第一题看成两人都取最优策略,写了个n^2的dp,还好pre-test良心(感觉TC和CF的pretest还是很靠谱的),让我反复过不去,仔细看题原来是取两边最大的啊!!!前30分钟就这样度过了...题目的分数啊刷刷掉啊( ˙灬˙ ).用了8分钟搞完第二题,然后第三题.第五题在1:20左右的时候开始写一个树状数组,1:29的时候写完了,结果样例不过,仔细看看居然是树状数组修改时从1开始修改的,无语啊.于是就......只做上了3道题,被虐的好惨啊... 第一题:模拟.. 第二题:…
Shortest Prefixes Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 15948   Accepted: 6887 Description A prefix of a string is a substring starting at the beginning of the given string. The prefixes of "carbon" are: "c", &qu…
题目链接:Prefixes and Suffixes 题意:给定未知字符串长度n,给出2n-2个字符串,其中n-1个为未知字符串的前缀(n-1个字符串长度从1到n-1),另外n-1个为未知字符串的后缀(n-1个字符串长度从1到n-1),判断这2n-2个字符串分别为前缀还是后缀. 题解:从2n-2从找个n-1长度的字符串和1长度的字符串拼接,判断该字符串是否符合要求,能作为未知字符串.符合的话,直接输出答案. #include <set> #include <map> #includ…
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>…
Shortest Prefixes Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 15574   Accepted: 6719 Description A prefix of a string is a substring starting at the beginning of the given string. The prefixes of "carbon" are: "c", &qu…
A. The Fair Nut and Elevator time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output The Fair Nut lives in nn story house. aiai people live on the ii-th floor of the house. Every person uses elevat…
题目: A. Sereja and Prefixes time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Sereja loves number sequences very much. That's why he decided to make himself a new one following a certain algor…
题目链接:POJ 2001 Description A prefix of a string is a substring starting at the beginning of the given string. The prefixes of "carbon" are: "c", "ca", "car", "carb", "carbo", and "carbon"…