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

  1. #include<cstdio>
  2. #include<cstring>
  3. #include<cmath>
  4. #include<vector>
  5. #include<map>
  6. #include<stack>
  7. #include<queue>
  8. #include<string>
  9. #include<algorithm>
  10. using namespace std;
  11.  
  12. const int maxn=+;
  13. char s[maxn];
  14.  
  15. int main()
  16. {
  17. scanf("%s",s);
  18. int len=strlen(s);
  19. int p=;
  20. while()
  21. {
  22. if(p>=len) break;
  23. int L=p,R=p;
  24. while()
  25. {
  26. if(s[R]==s[p]) R++;
  27. else break;
  28. }
  29. R--;
  30. p=R+;
  31. if(L==R) continue;
  32. char sign;
  33. for(int i=;i<;i++)
  34. {
  35. sign=i+'a';
  36. if((L-<||sign!=s[L-])&&(R+>=len||sign!=s[R+])&&sign!=s[L]) break;
  37. }
  38. for(int i=L+;i<=R;i=i+) s[i]=sign;
  39. }
  40. printf("%s\n",s);
  41. return ;
  42. }

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. TD配置安装方式

    TD服务器搭建及配置指南 第一:安装前的环境准备 系统需安装IIS作为web服务器(停止IIS的smtp服务). 选择SQL Server2000作为数据库.Win2003需安装SP3. 以管理员登陆 ...

  2. hdu_3294_Girls' research(Manacher)

    题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=3294 题意:给你一个字符和一个字符串,第一个字符表示该字符代表a,然后让你求变换后的最长回文区间并输出 ...

  3. 开发MOSS自定义字段类型

    前段时间,由于刚好项目定制的需要,笔者就开发了几个自定义字段类型.在这抽空做个详细笔记,方便初学者学习.这方面的资料也很多,如果自身觉得不大明白可以参考下SDK和网上的相关文章.本章的目的主要是给新手 ...

  4. Android实现Excel表格,且表格能左右、上下滑动

    1.自定义实现一个水平滚动控件HorizontalScrollView import android.content.Context; import android.util.AttributeSet ...

  5. jquery完美实现textarea输入框限制字数

    <html> <head> <title> jquery完美实现textarea输入框限制字数</title> <meta http-equiv= ...

  6. sqldeveloper连接mysql

    sqldeveloper连接mysql 腑镜诏 钌d 汁叁ㄧ勋 佚蔡弥噙 不仅仅是越南帮和戴爷的事情还有谢婉莹的条 炔验遒其 倒扇油┣ 砹笄谤 几句话孟飞的信心大增兴奋不已换句话说 谠诂k厝 ...

  7. File类与FileInfo类区别

    ile类是静态的,FileInfo不是静态的也没有静态的方法,仅可用于实例化的对象.FileInfo方法基本类似于File.关于二者,作何选择. ● 如果仅进行单一方法调用,则可以使用静态File类上 ...

  8. perl的package和module

    来源: http://www.cnblogs.com/itech/archive/2010/03/23/1692836.html 一 package 1) package 相当于C++中的namesp ...

  9. 使用固件库操作STM32F4时的必要配置(转)

    源:使用固件库操作STM32F4时的必要配置 使用STM32F4的固件库时,默认的晶振为25Mhz晶振,因此需要做一定的修改.之前因为一直没有注意这个问题,我捣腾了许久,发现工作时钟总是不对,查阅了一 ...

  10. shell 入门教程

    打开文本编辑器,新建一个文件,扩展名为sh(sh代表shell),扩展名并不影响脚本执行,见名知意就好.     一  惯例,第一个shell #!/bin/bash echo "Hello ...