[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 ...
随机推荐
- 关于 ActiveMQ 的消息模式
1.JMS Queue 执行 load balancer语义:一条消息仅能被一个 consumer(消费者) 收到.如果在 message 发送的时候没有可用的consumer,那么它将被保存一直到能 ...
- 设置 textarea 默认滑动到底部
javascript: var textarea = document.getElementById('textarea_id'); textarea.scrollTop = textarea.scr ...
- org.hibernate.MappingException: Unknown entity常见问题。回顾笔记,以前没记,现在补上,xiaochao写的蛮好的直接给转载了。
转自http://www.blogjava.net/xiaochao/articles/hibernatetopic.html. 官方说明如下: Hibernate遵循EJB3.0实体bean的注解规 ...
- java正则表达式四种常用的处理方式是怎么样呢《匹配、分割、代替、获取》
java 正则表达式高级篇,介绍四种常用的处理方式:匹配.分割.替代.获取,具体内容如下package test; import java.util.regex.Matcher; import jav ...
- HDU 2236:无题II(二分搜索+二分匹配)
http://acm.hdu.edu.cn/showproblem.php?pid=2236 题意:中文题意. 思路:先找出最大和最小值,然后二分差值,对于每一个差值从下界开始枚举判断能不能二分匹配. ...
- Codefroces Gym 100781A(树上最长路径)
http://codeforces.com/gym/100781/attachments 题意:有N个点,M条边,问对两两之间的树添加一条边之后,让整棵大树最远的点对之间的距离最近,问这个最近距离是多 ...
- IIS管理网站浏览
7.“/”应用程序中的服务器错误. 分析器错误 说明: 在分析向此请求提供服务所需资源时出错.请检查下列特定分析错误详细信息并适当地修改源文件.分析器错误消息: 文件“/Default.aspx.cs ...
- JavaScript脚本语言基础(三)
导读: 数学对象(Math) 数组对象(Array) 字符串对象(String) 日期对象(Date) js对象是属性和方法的集合.JavaScript中的所有事物都是对象,如:字符串.数值.数组.函 ...
- ACM题目————Robot Motion
Description A robot has been programmed to follow the instructions in its path. Instructions for the ...
- 2015-09-17 001 存储过程数据操作类 H_data_Helper
using System;using System.Data;using System.Configuration;using System.Linq;using System.Web;using S ...