[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 ...
随机推荐
- React组件开发
目录: 属性:props 内联样式 状态记忆 : state 生命周期 访问DOM 表单输入 承接快速入门篇:http://www.cnblogs.com/jasonnode/p/4444504.ht ...
- (一)MapReduce篇之InputFormat,InputSplit,RecordReader(转)
平时我们写MapReduce程序的时候,在设置输入格式的时候,总会调用形如job.setInputFormatClass(KeyValueTextInputFormat.class);来保证输入文件按 ...
- MySQL函数汇总
前言 MySQL提供了众多功能强大.方便易用的函数,使用这些函数,可以极大地提高用户对于数据库的管理效率,从而更加灵活地满足不同用户的需求.本文将MySQL的函数分类并汇总,以便以后用到的时候可以随时 ...
- OpenStack 物理资源问题
Contents [hide] 1 写在前面 2 openstack的自有设置 3 解决办法 4 最终解决办法 写在前面 物理CPU核数为12,能虚拟多少虚拟核的机器?openstack的默认使用no ...
- javaWeb el表达式和jstl快速入门案例
<%@page import="de.bvb.domain.Person"%> <%@page import="de.bvb.domain.Addres ...
- 进度条,随机数---demo笔记【原创】
本人学习笔记,参考网上代码完成 makefile TEST_OBJ := rng_app MAKEOPT := ARCH=arm CROSS_COMPILE=arm-none-linux-gnueab ...
- 【Pro ASP.NET MVC 3 Framework】.学习笔记.3.MVC的主要工具-单元测试
IProductRepository接口定义了一个仓库,我们通过它获得.更新Product对象.IPriceReducer接口指定了一个功能,它将要对所有的Products实施,通过一个参数,降低他们 ...
- symfony中twig的模板载入
模板 载入模板 {% include ‘sidebar.html’ %} 当前模板的变量也会传递到 被include的模板里,在那里面可以直接访问你这个模板的变量. {% for comment in ...
- Spring+Quartz实现定时执行任务的配置
1.要想使用Quartz 必须要引入相关的包:以下是我在项目中gradle中的配置: compile 'org.quartz-scheduler:quartz:2.1.1' 2.Scheduler的配 ...
- Java异常捕获之try-catch-finally-return的执行顺序-转载
情况1:try块中没有抛出异常try和finally块中都有return语句 public static int NoException(){ int i=10; try{ System.out.pr ...