codeforces 665C Simple Strings
相同的一段字母变一下就可以。
- #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的更多相关文章
- Codeforces 665C Simple Strings【暴力,贪心】
题目链接: http://codeforces.com/contest/665/problem/C 题意: 改变最少的字符,使得最终序列无相同的连续的字符. 分析: 对每一个与前一个字符相同的字符,枚 ...
- CodeForeces 665C Simple Strings
C. Simple Strings time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...
- codeforces 665C C. Simple Strings(乱搞)
题目链接: C. Simple Strings time limit per test 2 seconds memory limit per test 256 megabytes input stan ...
- Educational Codeforces Round 12 C. Simple Strings 贪心
C. Simple Strings 题目连接: http://www.codeforces.com/contest/665/problem/C Description zscoder loves si ...
- 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 ...
- Codeforces 626E Simple Skewness(暴力枚举+二分)
E. Simple Skewness time limit per test:3 seconds memory limit per test:256 megabytes input:standard ...
- Codeforces 868D Huge Strings - 位运算 - 暴力
You are given n strings s1, s2, ..., sn consisting of characters 0 and 1. m operations are performed ...
- CodeForces - 344B Simple Molecules (模拟题)
CodeForces - 344B id=46665" style="color:blue; text-decoration:none">Simple Molecu ...
- CodeForces 570B Simple Game 概率
原题: http://codeforces.com/contest/570/problem/B 题目: Simple Game time limit per test1 second memory l ...
随机推荐
- TD配置安装方式
TD服务器搭建及配置指南 第一:安装前的环境准备 系统需安装IIS作为web服务器(停止IIS的smtp服务). 选择SQL Server2000作为数据库.Win2003需安装SP3. 以管理员登陆 ...
- hdu_3294_Girls' research(Manacher)
题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=3294 题意:给你一个字符和一个字符串,第一个字符表示该字符代表a,然后让你求变换后的最长回文区间并输出 ...
- 开发MOSS自定义字段类型
前段时间,由于刚好项目定制的需要,笔者就开发了几个自定义字段类型.在这抽空做个详细笔记,方便初学者学习.这方面的资料也很多,如果自身觉得不大明白可以参考下SDK和网上的相关文章.本章的目的主要是给新手 ...
- Android实现Excel表格,且表格能左右、上下滑动
1.自定义实现一个水平滚动控件HorizontalScrollView import android.content.Context; import android.util.AttributeSet ...
- jquery完美实现textarea输入框限制字数
<html> <head> <title> jquery完美实现textarea输入框限制字数</title> <meta http-equiv= ...
- sqldeveloper连接mysql
sqldeveloper连接mysql 腑镜诏 钌d 汁叁ㄧ勋 佚蔡弥噙 不仅仅是越南帮和戴爷的事情还有谢婉莹的条 炔验遒其 倒扇油┣ 砹笄谤 几句话孟飞的信心大增兴奋不已换句话说 谠诂k厝 ...
- File类与FileInfo类区别
ile类是静态的,FileInfo不是静态的也没有静态的方法,仅可用于实例化的对象.FileInfo方法基本类似于File.关于二者,作何选择. ● 如果仅进行单一方法调用,则可以使用静态File类上 ...
- perl的package和module
来源: http://www.cnblogs.com/itech/archive/2010/03/23/1692836.html 一 package 1) package 相当于C++中的namesp ...
- 使用固件库操作STM32F4时的必要配置(转)
源:使用固件库操作STM32F4时的必要配置 使用STM32F4的固件库时,默认的晶振为25Mhz晶振,因此需要做一定的修改.之前因为一直没有注意这个问题,我捣腾了许久,发现工作时钟总是不对,查阅了一 ...
- shell 入门教程
打开文本编辑器,新建一个文件,扩展名为sh(sh代表shell),扩展名并不影响脚本执行,见名知意就好. 一 惯例,第一个shell #!/bin/bash echo "Hello ...