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 ...
随机推荐
- MFC应用程序编写实例—完整版(原创)
前段时间,将近花了一周至两周上班和上班后的闲余时间,做了一个用于调试和测试工作项目的应用软件,下面将实现软件的重要步骤及主要功能讲解一遍,方便日后查阅. 程序开始后,提示登录框,输入用户名,密码后,登 ...
- ReactiveCocoa总结
RAC三部曲,1创建信号,2订阅信号,3发送信号, 信号类: RACSiganl // 1.创建信号 RACSignal *siganl = [RACSignal createSignal:^R ...
- thinkphp整合系列之phpqrcode生成二维码
php生成二维码其实挺简单的:当然指的是使用qrcode类库: 因此关于是否要写这篇博客:我是犹豫了再三的: 不过最后还是决定写下吧:如果有童鞋急着用:就可以直接引了: 再个也可以作为即将写的文章微信 ...
- H5的新应用-指定视频的播放进度
<!DOCTYPE html> <html> <head> <title>指定视频的播放进度</title> <meta http-e ...
- Ubuntu服务器断网问题解决
原因:dns服务器没有了配置信息. 配置dns服务器 ubuntu 的dns服务器信息,放在 /etc/resolv.conf中, 添加dns服务器地址,如192. ...
- Nmap的使用【转载】
1.NMap工具 主要功能:探测主机是否在线.扫描主机开放端口和嗅探网络服务,用于网络探测和安全扫描. NMap支持很多扫描技术,例如:UDP.TCPconnect().TCPSYN(半开扫描).ft ...
- js实现td排序及分组分类
如题 <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.o ...
- cornerstone 怎么使用
Cornerstone的逻辑很清晰,界面打开后,左边栏上下分开,上面是working copies的列表,下面是REPOSITORIES的列表.常见的功能基本上跟windows一样,在上下文中可以得到 ...
- QProcess 进程类—调用外部程序
http://blog.csdn.net/newbee520/article/details/8279101 启动一个新的进程的操作非常简单,只需要将待启动的程序名称和启动参数传递给start() ...
- HTML-中<li>标签value值的兼容问题
今天在做项目测试的时候,发现IE浏览器对HTML中<li>标记的value取值存在兼容性问题,特意从4个浏览器出发进行了一些测试.现将测试结论展示如下: 测试类型 IE8 FF16.0.1 ...