Codeforces Round #481 (Div. 3) B. File Name
题目地址:http://codeforces.com/contest/978/problem/B
题解:一串文件名里不能出现连续的xxx,询问进行几次操作后,文件名才不会出现xxx。
方法:只要遍历一遍字符串里有几个xxx就可以了。
代码:(代码较丑,欢迎大佬们批评指正)
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<string>
#include<iostream>
#include<map>
#include<vector>
#include<set>
#include<queue>
using namespace std;
const int inf = 0x3f3f3f3f;
int main()
{
int n;
char s[];
scanf("%d", &n);
scanf("%s", s);
int ans = ;
for (int i = ; i < n;i++ )
{
if (s[i] == 'x' && s[i + ] == 'x'&&s[i + ] == 'x')
ans++;
}
printf("%d\n", ans);
return ;
}
Codeforces Round #481 (Div. 3) B. File Name的更多相关文章
- Codeforces Round #481 (Div. 3)
我实在是因为无聊至极来写Div3题解 感觉我主要的作用也就是翻译一下题目 第一次线上打CF的比赛,手速很重要. 这次由于所有题目都是1A,所以罚时还可以. 下面开始讲题 A.Remove Duplic ...
- Codeforces Round #481 (Div. 3)题解
成功掉到灰,真的心太累了,orz!!!!,不是很懂那些国外大佬为什么每次都是20多分钟AK的,QAQ A. Remove Duplicates time limit per test 1 second ...
- Codeforces Round #481 (Div. 3) D. Almost Arithmetic Progression
http://codeforces.com/contest/978/problem/D 题目大意: 给你一个长度为n的b(i)数组,你有如下操作: 对数组中的某个元素+1,+0,-1.并且这个元素只能 ...
- Codeforces Round #481 (Div. 3) G. Petya's Exams
http://codeforces.com/contest/978/problem/G 感冒是真的受不了...敲代码都没力气... 题目大意: 期末复习周,一共持续n天,有m场考试 每场考试有如下信息 ...
- Codeforces Round #481 (Div. 3) 全题解
A题,题目链接:http://codeforces.com/contest/978/problem/A 解题心得:题意就是让你将这个数列去重,重复的数只保留最右边的那个,最后按顺序打印数列.set+m ...
- Codeforces Round #481 (Div. 3) C. Letters
题目地址:http://codeforces.com/contest/978/problem/C 题解:有n个宿舍,每个宿舍人不一样多,有m封信,每封信送给对应的第m间房间,问这封信是给第几个宿舍,第 ...
- Codeforces Round #481 (Div. 3) A. Remove Duplicates
题目地址:http://codeforces.com/contest/978/problem/A 题解:给一串长度为n的数组,然后删去相同的数字(从右往左). 方法:题目n和数组ai给的范围都很小,所 ...
- Codeforces Round #481 (Div. 3)Petya's Exams CodeForces - 978G
Petya studies at university. The current academic year finishes with nn special days. Petya needs to ...
- Codeforces Round #481 (Div. 3) G. Petya's Exams (贪心,模拟)
题意:你有\(n\)天的时间,这段时间中你有\(m\)长考试,\(s\)表示宣布考试的日期,\(d\)表示考试的时间,\(c\)表示需要准备时间,如果你不能准备好所有考试,输出\(-1\),否则输出你 ...
随机推荐
- F#周报2019年第31期
新闻 现在开始接受FSSF的第七次师友计划申请 Xamarin播客:XAML热重载 TorchSharp:将PyTorch引擎带入.NET 视频及幻灯片 F#中的异步编程2/3--实现异步工作流 ML ...
- PythonDay05
第五章 今日内容 字典 字典 语法:{'key1':1,'key2':2} 注意:dict保存的数据不是按照我们添加进去的顺序保存的. 是按照hash表的顺序保存的. ⽽hash表 不是连续的. 所以 ...
- java支付宝app支付-代码实现
1.我们需要在支付宝商户平台配置好,取到四个参数如下(这是支付宝官方配置地址):https://www.cnblogs.com/fuzongle/p/10217144.html 合作身份者ID:123 ...
- cogs 1254. 最难的任务 Dijkstra + 重边处理
1254. 最难的任务 ★ 输入文件:hardest.in 输出文件:hardest.out 简单对比时间限制:1 s 内存限制:128 MB [题目描述] 这个真的很难.算出 123 ...
- Kotlin的特性
time streams try-with-resources 函数扩展,给types.classes或者interfaces新增方法 null safe 不需要new,后缀声明类型 自动转换有get ...
- Spring1
一.Spring是什么?有什么用? Spring的适用环境是这样的,假设现在有一个类port,它将提供一个返回消息的功能,代码如下: public class port { private weibo ...
- LeetCode——409. Longest Palindrome
题目: Given a string which consists of lowercase or uppercase letters, find the length of the longest ...
- SonarQube系列二、分析dotnet core/C#代码
[前言] 本系列主要讲述sonarqube的安装部署以及如何集成jenkins自动化分析.netcore项目.目录如下: SonarQube系列一.Linux安装与部署 SonarQube系列二.分析 ...
- 谷歌hack
0x00 网上搜集整理的一些可能会用到的Googlehack语法 0x01 intitle: 从网页标题中搜索指定的关键字,可专门用来搜索指定版本名称的各类 web 程序,也可用 allintitle ...
- spring security中@PreAuthorize注解的使用
添加依赖<!-- oauth --><dependency> <groupId>org.springframework.cloud</groupId> ...