相同的一段字母变一下就可以。

#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<algorithm>
using namespace std; const int maxn=+;
char s[maxn]; int main()
{
scanf("%s",s);
int len=strlen(s);
int p=;
while()
{
if(p>=len) break;
int L=p,R=p;
while()
{
if(s[R]==s[p]) R++;
else break;
}
R--;
p=R+;
if(L==R) continue;
char sign;
for(int i=;i<;i++)
{
sign=i+'a';
if((L-<||sign!=s[L-])&&(R+>=len||sign!=s[R+])&&sign!=s[L]) break;
}
for(int i=L+;i<=R;i=i+) s[i]=sign;
}
printf("%s\n",s);
return ;
}

codeforces 665C Simple Strings的更多相关文章

  1. Codeforces 665C Simple Strings【暴力,贪心】

    题目链接: http://codeforces.com/contest/665/problem/C 题意: 改变最少的字符,使得最终序列无相同的连续的字符. 分析: 对每一个与前一个字符相同的字符,枚 ...

  2. CodeForeces 665C Simple Strings

    C. Simple Strings time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...

  3. codeforces 665C C. Simple Strings(乱搞)

    题目链接: C. Simple Strings time limit per test 2 seconds memory limit per test 256 megabytes input stan ...

  4. Educational Codeforces Round 12 C. Simple Strings 贪心

    C. Simple Strings 题目连接: http://www.codeforces.com/contest/665/problem/C Description zscoder loves si ...

  5. Codeforce-Ozon Tech Challenge 2020-B. Kuroni and Simple Strings(贪心)

    B. Kuroni and Simple Strings time limit per test1 second memory limit per test256 megabytes inputsta ...

  6. Codeforces 626E Simple Skewness(暴力枚举+二分)

    E. Simple Skewness time limit per test:3 seconds memory limit per test:256 megabytes input:standard ...

  7. Codeforces 868D Huge Strings - 位运算 - 暴力

    You are given n strings s1, s2, ..., sn consisting of characters 0 and 1. m operations are performed ...

  8. CodeForces - 344B Simple Molecules (模拟题)

    CodeForces - 344B id=46665" style="color:blue; text-decoration:none">Simple Molecu ...

  9. CodeForces 570B Simple Game 概率

    原题: http://codeforces.com/contest/570/problem/B 题目: Simple Game time limit per test1 second memory l ...

随机推荐

  1. 第六节,初识python和字符编码

    程序语言的发展 机器语言 程序语言,最初的计算机语言是机器语言,完全是0和1组成的二进制串  如:01010101 11010101 汇编语言 因为01010101的字符串,冗长,不利于维护,所以产生 ...

  2. JavaScript高级程序设计:第十七章

    错误处理与调试 一.错误处理 1.try-catch语句: ECMA-262第3版引入了try-catch语句,作为javascript中处理异常的一种标准方式.基本的语法如下: try { //可能 ...

  3. java IO类图

  4. 关于getchar()的知识

    char* s1 = "123",字符串"123"这段内存是只读的,就是说其内容不能改变///char *s 这个是指申请一个地址空间 记录一个地址 #incl ...

  5. Cake

    Cake Time Limit : 1000/1000ms (Java/Other)   Memory Limit : 32768/32768K (Java/Other) Total Submissi ...

  6. java FLOAT

    System.out.println(""+ 1/2); 得不到0.5,只能得到0. 要想打印出浮点数,必须除数和被除数至少有一个是浮点数,像这样: System.out.prin ...

  7. [转]Flash、Flex、AS3.0框架及类库资源收集之十全大补

    原文地址:http://www.d5power.com/portal.php?mod=view&aid=27 APIs.Libs.Components1.as3ebaylibhttp://co ...

  8. MSSQL 字符串XML 合成列

    declare @str varchar(2000) set @str='1,2,3,4,6,8,5,9,10,11,12,13,14,15,16,17,18,19,20,29,30,31,32,33 ...

  9. Spring MVC中前后台数据传输小结

    前台向后台传递参数: @ResponseBody @RequestMapping(value = "/findById/{id}", method = { RequestMetho ...

  10. LightOJ 1336 Sigma Function 算数基本定理

    题目大意:f(n)为n的因子和,给出 n 求 1~n 中f(n)为偶数的个数. 题目思路:算数基本定理: n=p1^e1*p2^e1 …… pn^en (p为素数): f(n)=(1+p1+p1^2+ ...