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. [Web 前端] 034 计算属性,侦听属性

    目录 0. 方便起见,定个轮廓 1. 过滤器 2. 计算属性 2.1 2.2 3. 监听属性 0. 方便起见,定个轮廓 不妨记下方的程序为 code1 <!DOCTYPE html> &l ...

  2. [Git] 017 加一条分支,享双倍快乐

    0. 回顾 [Git] 009 逆转未来 中的 "2.2" 讲过 git checkout -- <file> 这回的 git checkout <branch_ ...

  3. SpringBoot自定义Starter实现

    自定义Starter: Starter会把所有用到的依赖都给包含进来,避免了开发者自己去引入依赖所带来的麻烦.Starter 提供了一种开箱即用的理念,其中核心就是springboot的自动配置原理相 ...

  4. 本地项目代码上传至github

    初始化本地目录:git init cd到个人本地项目代码文件目录下,执行git init命令 添加项目文件到本地仓库:git add .   git commit -m "提交说明" ...

  5. vue+express利用token 完成前后端登录

    token是后端给前端的一个二维码, 这个二维码一般是暗码,  前端拿着这个二维码到后端, 后端便可以通过这个二维码得知用户是否登录过, 用户是谁等信息(具体什么信息,是后端在返回token时候设置的 ...

  6. P3958奶酪

    这个题是2017noip提高组的真题,是一个深度搜索题,得分轨迹:10-80-100pts. 在三维空间里,存在可能连通的洞(半径r),问是否可以通过这些洞从底部到达顶部.一开始我联想到了01迷宫,以 ...

  7. px-em-pt等字体的不同

  8. Neo4j源代码分析

    1.下载neo4j源码 https://github.com/neo4j/neo4j/ 参考文章 原文地址:https://blog.csdn.net/e15273/article/details/7 ...

  9. es6中class类的全方面理解(一)

    传统的javascript中只有对象,没有类的概念.它是基于原型的面向对象语言.原型对象特点就是将自身的属性共享给新对象.这样的写法相对于其它传统面向对象语言来讲,很有一种独树一帜的感脚!非常容易让人 ...

  10. Chrome开发者工具详解(四)之Elements、Console、Sources面板

    Elements面板 实时编辑DOM节点和CSS样式 双击DOM树视图里面的节点,可以实时编辑标签属性,修改的效果会立刻反应在浏览器里 点击右侧Style面板,可以实时修改CSS的属性值,这里面的所有 ...