[CF738A]Interview with Oleg(模拟)
题目链接:http://codeforces.com/contest/738/problem/A
题意:把ogo..ogo替换成***。
写的有点飘,还怕FST。不过还好
#include <bits/stdc++.h>
using namespace std; const int maxn = ;
int n, m;
char s[maxn];
char t[maxn]; int main() {
// freopen("in", "r", stdin);
while(~scanf("%d", &n)) {
scanf("%s", s);
m = ;
memset(t, , sizeof(t));
for(int i = ; s[i]; i++) {
if(s[i] == 'o') {
int j = i;
while() {
if(s[j+] == 'g' && s[j+] == 'o') j += ;
else break;
}
if(j != i) {
t[m++]='*'; t[m++]='*'; t[m++]='*';
i = j;
} else t[m++] = s[i];
} else t[m++] = s[i];
}
puts(t);
}
return ;
}
[CF738A]Interview with Oleg(模拟)的更多相关文章
- Interview with Oleg
Interview with Oleg time limit per test 1 second memory limit per test 256 megabytes input standard ...
- 【Codeforces 738A】Interview with Oleg
http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...
- 【57.97%】【codeforces Round #380A】Interview with Oleg
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- CodeForces 738A Interview with Oleg
模拟. #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #includ ...
- CF729A Interview with Oleg 题解
Content 给出一个长度为 \(n\) 字符串 \(s\),请将开头为 \(\texttt{ogo}\),后面带若干个 \(\texttt{go}\) 的子串替换成 \(\texttt{***}\ ...
- Codeforces 631A Interview【模拟水题】
题意: 模拟模拟~~ 代码: #include<iostream> using namespace std; const int maxn = 1005; int a[maxn], b[m ...
- [译]Node.js Interview Questions and Answers (2017 Edition)
原文 Node.js Interview Questions for 2017 什么是error-first callback? 如何避免无止境的callback? 什么是Promises? 用什么工 ...
- Google Interview University - 坚持完成这套学习手册,你就可以去 Google 面试了
作者:Glowin链接:https://zhuanlan.zhihu.com/p/22881223来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出处. 原文地址:Google ...
- Cracking the Coding Interview(Stacks and Queues)
Cracking the Coding Interview(Stacks and Queues) 1.Describe how you could use a single array to impl ...
随机推荐
- iBatis叙述
1.添加Mybatis的配置文件conf.xml 在src目录下创建一个conf.xml文件,如下图所示: 2.定义表所对应的实体类 3.定义操作users表的sql映射文件userMapper.xm ...
- 爱普生 RS330 打印机墨水连供装置墨盒吸墨复位方法
芯片复位方法: 先按充墨键(墨水灯按键),一下一下按,把墨车按停到右侧换墨盒的位置为止(就是右侧框框正中位置), 全程带电操作,停到换墨盒的位置后再按住芯片复位键(墨盒芯片上面白色的小按键)5秒以上再 ...
- 转:redis常用命令
一 Redis介绍 Redis是一个开源的使用ANSI C语言编写.支持网络.可基于内存亦可持久化的日志型.Key-Value数据库,并提供多种语言的API.从2010年3月15日起,Redis的开发 ...
- diff 文件比较
测试数据: [xiluhua@vm-xiluhua][~]$ cat msn.txt aaa bbb bbb ccc ccc ddd bbb eee aaa ccc bbb sss [xiluhua@ ...
- Hibernate,JPA注解@SecondaryTable
使用类一级的 @SecondaryTable或@SecondaryTables注解可以实现单个实体到多个表的映射. 使用 @Column或者 @JoinColumn注解中的table参数可指定某个列所 ...
- java.security.NoSuchAlgorithmException: DES KeyGenerator not available
更改jre,点击项目build path-->configure build path-->libraries-->jre library system-->edit--> ...
- 工具项与菜单项实现相同的功能(DevExpress)
1.在工具栏中添加菜单项.如下:在bar1工具栏中添加菜单项this.barButtonMenuItem(包含图标) this.bar1.LinksPersistInfo.AddRange(new D ...
- 20145227 《Java程序设计》第4周学习总结
20145227 <Java程序设计>第4周学习总结 教材学习内容总结 第六章 继承与多态 6.1 何谓继承 1.继承共同行为 多个类中存在相同属性和行为时,将这些内容抽取到单独一个类中, ...
- Android动画的使用总结
1.补间动画(透明渐变.平移.旋转.缩放.组合) 方法一:通过xml文件设置 1-1:创建:res/anim 1-2:java代码写调用 Animation a = AnimationUtils.lo ...
- SQL数据类型大全 《转自网络》
数据类型是数据的一种属性,表示数据所表示信息的类型.任何一种计算机语言都定义了自己的数据类型.当然,不同的程序语言都具有不同的特点,所定义的数据类型的种类和名称都或多或少有些不同.SQLServer ...