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 ...
随机推荐
- git远程分支--remote
查看所有远程引用: $ git ls-remote From ssh://someone@example/testgit ebf3ef7551603cd57a699e80db0bfab36d1aa7b ...
- Entity Framework Code First ---EF Power Tool 和MySql一起使用遇到的问题
关于如何使用EF Power Tool的介绍请看 http://www.cnblogs.com/LingzhiSun/archive/2011/05/24/EFPowerTool_1.html, 这里 ...
- 图解HTTP读书笔记--精简版
这本书重点讲了两点,分别是 HTTP的报文格式 HTTPS比HTTP优秀在哪里 接下来分部分讨论一下: 1. HTTP的报文格式 请求报文格式: 请求行 指明请求方法 请求路径 和协议 如 ...
- anyremote源码分析
XTest 鼠标移动事件. XTestFakeMotionEvent 关于XTest的编程. http://lilydjwg.is-programmer.com/2011/9/21/using-x ...
- 关于Winform中的用户代理
问题描述: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 解释: 1. 应用程序版本“Mozilla ...
- js中对style中的多个属性进行设值
js中对style中的多个属性进行设值: 看一下案例自然就明白: document.getElementById("my_wz1").style.cssText="bac ...
- java socket解析和发送二进制报文工具(附java和C++转化问题)
解析: 首先是读取字节: /** * 读取输入流中指定字节的长度 * <p/> * 输入流 * * @param length 指定长度 * @return 指定长度的字节数组 */ pu ...
- cddiv/数组维护
题目连接 看代码: #include <set> #include <map> #include <cmath> #include <queue> #i ...
- AppCompatActivity工具栏的设置(返回操作)
<android.support.v7.widget.Toolbar android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionB ...
- c语言判断打开文件是否为空的方法
void writeReslut2(char* caseName,double averageTime,double max, double min,int loops,int size){ fpos ...