Codeforce Problem 711A - Bus to Udayland (正则表达式)
https://codeforces.com/problemset/problem/711/A
正则表达式基本应用
#include<bits/stdc++.h>
using namespace std;
int n, i;
string s, t;
int main() {
//freopen("in.txt", "r", stdin);
cin >> n; while (n--)cin >> s, t += s + "\n";//将字符累加到一个大字符串中
i = t.find("OO");//也可以用match替换
if (i >= 0)t.replace(i, 2, "++"), cout << "YES" << endl << t;
else cout << "NO";
return 0;
}
Codeforce Problem 711A - Bus to Udayland (正则表达式)的更多相关文章
- 【模拟】Codeforces 711A Bus to Udayland
题目链接: http://codeforces.com/problemset/problem/711/A 题目大意: N个字符串,每个字符串5位,找到第一个出现两个OO的并改成++输出YES和改后字符 ...
- CodeForces 711A Bus to Udayland (水题)
题意:给定一个n*4的矩阵,然后O表示空座位,X表示已经有人了,问你是不能找到一对相邻的座位,都是空的,并且前两个是一对,后两个是一对. 析:直接暴力找就行. 代码如下: #pragma commen ...
- CodeForces 711A Bus to Udayland
简单题. #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #inclu ...
- codeforces 711A A. Bus to Udayland(水题)
题目链接: A. Bus to Udayland 题意: 找一对空位坐下来,水; 思路: AC代码: #include <iostream> #include <cstdio> ...
- Codeforces Round #369 (Div. 2) A. Bus to Udayland 水题
A. Bus to Udayland 题目连接: http://www.codeforces.com/contest/711/problem/A Description ZS the Coder an ...
- Codeforces Round #369 (Div. 2) A. Bus to Udayland (水题)
Bus to Udayland 题目链接: http://codeforces.com/contest/711/problem/A Description ZS the Coder and Chris ...
- Codeforces Round #369 (Div. 2) A. Bus to Udayland【字符串/二维字符数组求连起来的座位并改为其他字符】
A. Bus to Udayland time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- A. Bus to Udayland
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa ...
- 洛谷 题解 CF711A 【Bus to Udayland】
先用一个字符数组存每行的座位情况(字符变量也可以) 接下来用另一个数组存最后的座位情况 好了,看代码 #include<iostream> using namespace std; boo ...
- Ural 1011. Conductors
1011. Conductors Time limit: 2.0 secondMemory limit: 64 MB Background Everyone making translations f ...
随机推荐
- 七天.NET 8操作SQLite入门到实战 - 第三天SQLite快速入门
前言 今天我们花费一个小时快速了解SQLite数据类型.SQLite常用命令和语法. 七天.NET 8操作SQLite入门到实战详细教程 第一天 SQLite 简介 第二天 在 Windows 上配置 ...
- Cadence SPB 22.1 --学习基础01Day
1.电路图设计 ①.原理图设计 原理图符号-->原理图库:代替实际电子元器件的符号,主要就是引脚数目.引脚序号与实物对应: ②.PCB设计 PCB符合-->PCB封装库:电子元器件的各种实 ...
- java集合框架(二)LinkedList的常见使用
@[toc]## 一.什么是LinkedList LinkedList是Java中的一个双向链表. 它实现了List和Deque接口,在使用时可以像List一样使用元素索引,也可以像Deque一样使用 ...
- STM32一个定时器输出四路不同频率和占空比PWM波的方法
一般来说,一个定时器输出4路频率相同.占空比不同的PWM波是比较容易的,使用PWM模式即可实现.如果说是输出4路频率不同.占空比不同的PWM就没有现成的模式,是不是无法实现了呢?答案肯定是" ...
- 关于mac电脑突然搜不到家里wifi但手机却能连上的问题解决
今天用mac电脑时,突然遇到一个奇怪的问题,家里wifi用的好好的,突然就连不上了,在看电脑能搜索到的wifi,居然家里的wifi都没有搜索到,但自己的手机却是正常的,然后我再看看我另外一台windo ...
- HDU 4787 GRE Revenge
Now Coach Pang is preparing for the Graduate Record Examinations as George did in 2011. At each day, ...
- springBoot——读取数据
在yml文件中读取数据,用$符号就可以 类似于这样的 如果要读取yml里面全部的数据,就用自动装配来写 而如果要用实体类来读取里面的数据 package com.example.springboot_ ...
- python在容器内克隆拉取git私有仓库
前言 目前有个python应用需要在容器镜像内拉取git私有仓库的代码,一开始的想法是用GitPython,折腾一番ssh私钥和known_hosts问题后,发现还是在镜像中封装个git最省事,然后用 ...
- windows环境下如何优雅搭建ftp服务?
目录 0. 前言 1.ftp简介 2.下载Apache FTPServer 3.下载并解压压缩包 4.修改配置文件 4.1 修改users.properties配置文件 4.2 修改ftpd-typi ...
- 日常Bug排查-应用Commit报错事务并没有回滚
日常Bug排查-应用Commit报错事务并没有回滚 前言 日常Bug排查系列都是一些简单Bug排查,笔者将在这里介绍一些排查Bug的简单技巧,同时顺便积累素材_. 应用Commit报错并不一定回滚 事 ...