[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 ...
随机推荐
- yii2语言设置
1.父配置文件在yii2/base/Application中的$language="en-US", 修改项目的语言可以修改项目的配置文件main.php中加'language'=& ...
- MYSQL 、Oracle、SQLServer 数据库中时间的格式化输出
在MYSQL 中格式化输出 date_forma t(date,'yyyyMMddHHmmss') Oracle 中格式化输出 to_char(time ,'yyyyMMddHHmmss') SQL ...
- IMG图片和文字同行显示
只要设定img标签的vertical-align CSS属性就好了,代码如下: <img src="images/untitled.png" style="widt ...
- VMware中安装CentOS7网络配置静态IP地址,常用配置和工具安装
VMware中安装CentOS7网络配置静态IP地址,常用配置和工具安装在阿里云开源镜像地址下载镜像Index of /centos/7.2.1511/isos/x86_64/http://mirro ...
- javaWeb 使用jsp开发 if else 标签
1.jsp页面调用代码 <t:choose> <t:when test="${user==null }">还没有登录</t:when> < ...
- 那些情况该使用它们spin_lock到spin_lock_irqsave【转】
转自:http://blog.csdn.net/wesleyluo/article/details/8807919 权声明:本文为博主原创文章,未经博主允许不得转载. Spinlock的目的是用来同步 ...
- 指令重排序及Happens-before法则随笔
指令重排序 对主存的一次访问一般花费硬件的数百次时钟周期.处理器通过缓存(caching)能够从数量级上降低内存延迟的成本这些缓存为了性能重新排列待定内存操作的顺序.也就是说,程序的读写操作不一定会按 ...
- Pascal's Triangle
class Solution { public: vector<vector<int>> generate(int numRows) { vector<vector< ...
- JavaScript的一些基本语句代码如下!!!!
<html><body> <script type="text/javascript">document.write("<h1& ...
- symfony中twig的流程控制if,for用法
流程控制 if 语句 if语句在twig中的作用如同if语句在PHP中的一样.1.你可以通过下面这个简单的例子来判断表达式的结果是否正确. {% if online == false %} <p ...