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

  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. MFC应用程序编写实例—完整版(原创)

    前段时间,将近花了一周至两周上班和上班后的闲余时间,做了一个用于调试和测试工作项目的应用软件,下面将实现软件的重要步骤及主要功能讲解一遍,方便日后查阅. 程序开始后,提示登录框,输入用户名,密码后,登 ...

  2. ReactiveCocoa总结

    RAC三部曲,1创建信号,2订阅信号,3发送信号, 信号类: RACSiganl // 1.创建信号    RACSignal *siganl = [RACSignal createSignal:^R ...

  3. thinkphp整合系列之phpqrcode生成二维码

    php生成二维码其实挺简单的:当然指的是使用qrcode类库: 因此关于是否要写这篇博客:我是犹豫了再三的: 不过最后还是决定写下吧:如果有童鞋急着用:就可以直接引了: 再个也可以作为即将写的文章微信 ...

  4. H5的新应用-指定视频的播放进度

    <!DOCTYPE html> <html> <head> <title>指定视频的播放进度</title> <meta http-e ...

  5. Ubuntu服务器断网问题解决

    原因:dns服务器没有了配置信息. 配置dns服务器          ubuntu 的dns服务器信息,放在 /etc/resolv.conf中,          添加dns服务器地址,如192. ...

  6. Nmap的使用【转载】

    1.NMap工具 主要功能:探测主机是否在线.扫描主机开放端口和嗅探网络服务,用于网络探测和安全扫描. NMap支持很多扫描技术,例如:UDP.TCPconnect().TCPSYN(半开扫描).ft ...

  7. js实现td排序及分组分类

    如题 <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.o ...

  8. cornerstone 怎么使用

    Cornerstone的逻辑很清晰,界面打开后,左边栏上下分开,上面是working copies的列表,下面是REPOSITORIES的列表.常见的功能基本上跟windows一样,在上下文中可以得到 ...

  9. QProcess 进程类—调用外部程序

    http://blog.csdn.net/newbee520/article/details/8279101   启动一个新的进程的操作非常简单,只需要将待启动的程序名称和启动参数传递给start() ...

  10. HTML-中<li>标签value值的兼容问题

    今天在做项目测试的时候,发现IE浏览器对HTML中<li>标记的value取值存在兼容性问题,特意从4个浏览器出发进行了一些测试.现将测试结论展示如下: 测试类型 IE8 FF16.0.1 ...