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. [转帖]同事推荐的的aira2

    Windows系统安装最新版Aria2客户端及使用教程 https://www.moerats.com/archives/519/ 改天学习一下. 说明:之前都是说的在Linux VPS服务器上安装A ...

  2. python 三元表达式

    python 三元表达式(ternary expression)  把 if-else块 写到一行或者一个表达式中 并且产生一个值 value = true if condition else fal ...

  3. JAVA poi设置单元格背景颜色

    import java.io.FileOutputStream; import java.io.IOException;   import org.apache.poi.ss.usermodel.Ce ...

  4. [LeetCode] 92. 反转链表 II

    题目链接 : https://leetcode-cn.com/problems/reverse-linked-list-ii/ 题目描述: 反转从位置 m 到 n 的链表.请使用一趟扫描完成反转. 说 ...

  5. Python 入门之流程控制语句

    Python 入门之流程控制语句 1.if判断 (1) 单 if if –-如果 if 条件: 缩进 结果 (官方推荐4个空格,或者一个tab 不能空格和tab混合使用) money = 10 pri ...

  6. Python yield用法浅析(stackoverflow)

    这是stackoverflow上一个关于python中yield用法的帖子,这里翻译自投票最高的一个回答,原文链接 here 问题 Python中yield关键字的用途是什么?它有什么作用?例如,我试 ...

  7. springboot2.0-统一处理返回结果和异常情况

    一.统一处理返回结果和异常处理的原因: 1.在springboot项目里我们希望接口返回的数据包含至少三个属性: a.code:请求接口的返回码,成功或者异常等返回编码,例如定义请求成功,code = ...

  8. 如何让css隐藏滚动条 兼容谷歌、火狐、IE等各个浏览器

    项目中,页面效果需要展示一个页面的移动端效果,使用的是一个苹果手机样式背景图,咋也没用过苹果,咋也不敢形容. 如下图所示: 在谷歌浏览器如图一滚动条顺利隐藏,但是火狐就如图二了,有了滚动条丑的一批. ...

  9. 史上最全Java学习视频下载地址分享

    http://blog.csdn.net/xlgen157387/article/details/39735141

  10. VMware虚拟机NAT模式无法上外网

    VMware虚拟机NAT模式无法上外网排错思路 1,确保三种模式只有一种在连接 2,确保ip配置正确 配置的子网跟DHCP必须是同一网段 3,确保网关配置正确 网关不管怎么配,一定不要配192.168 ...