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. Jmeter 03 Jmeter断言之Json断言

    json断言可以让我们很快的定位到响应数据中的某一字段,当然前提是响应数据是json格式的,所以如果响应数据为json格式的话,使用json断言还是相当方便的. 还是以之前的接口举例 Url: htt ...

  2. js函数的定义和调用

    函数的定义 函数使用function 声明,后跟一组参数以及函数体,语法如下: function functionName([age0,age1,......argn]){ statements } ...

  3. linux中防止黑客进入单用户模式进行强制修改密码窃取数据

    如何防止别人恶意通过单用户系统破解root密码,进入系统窃取数据? 给grub加密,不让别人通过grub进入单用户. 当前系统:CentOS Linux release 7.6.1810 (Core) ...

  4. [DS+Algo] 008 查找

    1. 常见搜索方法 顺序查找 最优时间复杂度:O(1) 最坏时间复杂度:O(n) 二分法 最优时间复杂度:O(1) 最坏时间复杂度:O(logn) 二叉树 若是"二叉搜索树" 最优 ...

  5. CF682C Alyona and the Tree

    题意翻译 题目描述 给你一棵树,边与节点都有权值,根节点为1,现不停删除叶子节点形成新树,问最少删掉几个点,能使得最后剩下的树内,∀v与其子树内∀u间边权的和小于点u权值 输入输出格式 输入格式: 第 ...

  6. 最长上升子序列(LIS) Easy

    A numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let the subsequence of the given ...

  7. 网络爬虫之HTTPClient

    HTTPClient官网:http://hc.apache.org/httpcomponents-client-4.5.x/quickstart.html 问题一:明明浏览器请求有数据,可使用HTTP ...

  8. vue项目1-pizza点餐系统5-全局守卫

    一.导航守卫描述 当问我们点击主页.菜单等非登陆和注册按钮都会提示先登陆然后跳转到登陆界面. 1.在main.js中引入全局守卫 //全局守卫 //to是要进入那个路由,from是从那个路由出来,ne ...

  9. Linux Qt cannot find -lGL错误完美解决方案(亲测有效)

    http://c.biancheng.net/view/3901.html 对于很多 Linux 发行版本,Qt 安装完成后如果直接编译或者运行项目,会出现“cannot find -lGL”错误,如 ...

  10. /proc/sys/fs/file-max

    Linux的/proc/sys/fs/file-max决定了当前内核可以打开的最大的文件句柄数. 查看当前的值: cat /proc/sys/fs/file-max 这个值在kernel的文档里是这样 ...