Bus to Udayland

题目链接:

http://codeforces.com/contest/711/problem/A

Description


```
ZS the Coder and Chris the Baboon are travelling to Udayland! To get there, they have to get on the special IOI bus. The IOI bus has n rows of seats. There are 4 seats in each row, and the seats are separated into pairs by a walkway. When ZS and Chris came, some places in the bus was already occupied.

ZS and Chris are good friends. They insist to get a pair of neighbouring empty seats. Two seats are considered neighbouring if they are in the same row and in the same pair. Given the configuration of the bus, can you help ZS and Chris determine where they should sit?

</big>

##Input
<big>

The first line of the input contains a single integer n (1 ≤ n ≤ 1000) — the number of rows of seats in the bus.

Then, n lines follow. Each line contains exactly 5 characters, the first two of them denote the first pair of seats in the row, the third character denotes the walkway (it always equals '|') and the last two of them denote the second pair of seats in the row.

Each character, except the walkway, equals to 'O' or to 'X'. 'O' denotes an empty seat, 'X' denotes an occupied seat. See the sample cases for more details.

</big>

##Output
<big>

If it is possible for Chris and ZS to sit at neighbouring empty seats, print "YES" (without quotes) in the first line. In the next n lines print the bus configuration, where the characters in the pair of seats for Chris and ZS is changed with characters '+'. Thus the configuration should differ from the input one by exactly two charaters (they should be equal to 'O' in the input and to '+' in the output).

If there is no pair of seats for Chris and ZS, print "NO" (without quotes) in a single line.

If there are multiple solutions, you may print any of them.

</big>

##Examples
<big>

input

6

OO|OX

XO|XX

OX|OO

XX|OX

OO|OO

OO|XX

output

YES

++|OX

XO|XX

OX|OO

XX|OX

OO|OO

OO|XX

input

4

XO|OX

XO|XX

OX|OX

XX|OX

output

NO

input

5

XX|XX

XX|XX

XO|OX

XO|OO

OX|XO

output

YES

XX|XX

XX|XX

XO|OX

XO|++

OX|XO

</big>

##Note
<big>

Note that the following is an incorrect configuration for the first sample case because the seats must be in the same pair.

O+|+X

XO|XX

OX|OO

XX|OX

OO|OO

OO|XX

</big>

<br/>
##题意:
<big>
找有没有相邻座位.
</big> <br/>
##题解:
<big>
暴力判断一下即可.
</big> <br/>
##代码:
``` cpp
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <vector>
#include <list>
#define LL long long
#define eps 1e-8
#define maxn 101000
#define mod 100000007
#define inf 0x3f3f3f3f
#define mid(a,b) ((a+b)>>1)
#define IN freopen("in.txt","r",stdin);
using namespace std; int n;
char str[1010][15]; int main(int argc, char const *argv[])
{
// IN; while(scanf("%d" ,&n) != EOF)
{
for(int i=1; i<=n; i++) {
scanf("%s", str[i]);
} bool flag = 0;
for(int i=1; i<=n; i++) {
if(str[i][0] == 'O' && str[i][1] == 'O') {
flag = 1;
str[i][0] = '+'; str[i][1] = '+';
break;
}
if(str[i][3] == 'O' && str[i][4] == 'O') {
flag = 1;
str[i][3] = '+'; str[i][4] = '+';
break;
}
} if(!flag) printf("NO\n");
else {
printf("YES\n");
for(int i=1; i<=n; i++) {
printf("%s\n", str[i]);
}
}
} return 0;
}

Codeforces Round #369 (Div. 2) A. Bus to Udayland (水题)的更多相关文章

  1. 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 ...

  2. 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 ...

  3. Codeforces Round #297 (Div. 2)A. Vitaliy and Pie 水题

    Codeforces Round #297 (Div. 2)A. Vitaliy and Pie Time Limit: 2 Sec  Memory Limit: 256 MBSubmit: xxx  ...

  4. Codeforces Round #290 (Div. 2) A. Fox And Snake 水题

    A. Fox And Snake 题目连接: http://codeforces.com/contest/510/problem/A Description Fox Ciel starts to le ...

  5. Codeforces Round #322 (Div. 2) A. Vasya the Hipster 水题

    A. Vasya the Hipster Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/581/p ...

  6. Codeforces Round #373 (Div. 2) B. Anatoly and Cockroaches 水题

    B. Anatoly and Cockroaches 题目连接: http://codeforces.com/contest/719/problem/B Description Anatoly liv ...

  7. Codeforces Round #368 (Div. 2) A. Brain's Photos 水题

    A. Brain's Photos 题目连接: http://www.codeforces.com/contest/707/problem/A Description Small, but very ...

  8. Codeforces Round #359 (Div. 2) A. Free Ice Cream 水题

    A. Free Ice Cream 题目连接: http://www.codeforces.com/contest/686/problem/A Description After their adve ...

  9. Codeforces Round #355 (Div. 2) A. Vanya and Fence 水题

    A. Vanya and Fence 题目连接: http://www.codeforces.com/contest/677/problem/A Description Vanya and his f ...

随机推荐

  1. SQL如何通过当前日期获取上周一日期【转】

    --当前时间 select getdate() --当前时间周的起始日期(以周一为例) ,) --上周起始: ,,)) --上上周起始: ,,)) --上上上周起始:s elect ,,))

  2. P5016龙虎斗

    这道题是2018年普及组的第二题,是一个模拟题. 首先计算出双方各自的势力,然后将增援的队伍势力加上,比较此时双方势力,并且作差,最后枚举将公平兵加在哪一个兵营.看似简单的题被我20分钟就写完了,但是 ...

  3. 腾讯云从零搭建PHP运行环境

    一.首先我们得注册腾讯云,租用一台服务器,我选择的是CentOS 7.2 64位,这时候会给你这台主机的公网IP和内网IP,以及这台主机的用户名及密码. 二.我们可以使用腾讯云网页上自带的登录按钮进行 ...

  4. MySQL总结(3)

    ORDER BY 与 GROUP BY ORDER BY GROUP BY 排序产生的输出 分组行.但输出可能不是分组的顺序 不一定需要 如果与聚集函数一起使用列(或表达式)则必须使用 任意列都可以使 ...

  5. laravel5.5结合bootstrap上传插件fileinput 上传图片

    引入相关js <script src="{{ asset('bootstrap-fileinput/js/fileinput.js') }}"></script& ...

  6. You-Get,多网站视频下载工具,非常方便

    You-Get是一个非常优秀的网站视频下载工具.使用You-Get可以很轻松的下载到网络上的视频.图片及音乐. 按Win+R键打开运行,输入cmd,再输入命令 pip install you-get, ...

  7. 出现( linker command failed with exit code 1)错误总结(http://blog.csdn.net/hengshujiyi/article/details/21182813)

    这种问题,通常出现在添加第三方库文件或者多人开发时. 这种问题一般是找不到文件而导致的链接错误. 我们可以从如下几个方面着手排查. 1.以如下错误为例,如果是多人开发,你同步完成后发现出现如下的错误. ...

  8. Java基础学习(2)

    Java基础学习(二) 面向对象 对象:客观存在的事物 面向对象:人具体关注的事物的某些信息 类:是模子,确定对象会拥有的特征(属性)和行为(方法) 对象的属性:对象具有的各种特征 对象的方法:对象能 ...

  9. alex说:一切皆bytes

    一.ASCII ASCII(American Standard Code for Information Interchange),是一种单字节的编码.计算机世界里一开始只有英文,而单字节可以表示25 ...

  10. C# Base64加解密

    using System; using System.Collections.Generic; using System.Text; using System.Security.Cryptograph ...