A. Bus to Udayland
time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

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 nrows 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?

Input

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.

Output

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.

Examples
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
Note

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

【分析】:我,傻逼,把字符数组写错成了整型数组,De了好久bug!

【代码】:

#include <bits/stdc++.h>

using namespace std;
char a[][];
int main()
{
int n;
while(~scanf("%d",&n))
{
for(int i=;i<n;i++)
{
scanf("%s",a[i]);
}
int f=;
for(int i=;i<n;i++)
{
if(a[i][]==a[i][]&&a[i][]=='O')
{
f=;
a[i][]=a[i][]='+';
break;
}
if(a[i][]==a[i][]&&a[i][]=='O')
{
f=;
a[i][]=a[i][]='+';
break;
}
}
if(f==)
{
printf("YES\n");
for(int i=;i<n;i++)
{
for(int j=;j<;j++)
{
printf("%c",a[i][j]);
}
printf("\n");
}
}
else
{
printf("NO\n");
}
}
return ;
}

注意是char数组!

void print1(int n)
{
for(i=;i<n;i++)
{
printf("%s",s[i]);
printf("\n");
}
} void print2(int n)
{
for(int i = ; i < n; i++)
{
for(int j = ; j < ; j++)
{
cout << s[i][j];
}
cout << '\n';
}
}

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 (水题)

    Bus to Udayland 题目链接: http://codeforces.com/contest/711/problem/A Description ZS the Coder and Chris ...

  3. Codeforces Round #369 (Div. 2) A B 暴力 模拟

    A. Bus to Udayland time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  4. Codeforces Round #436 (Div. 2)C. Bus 模拟

    C. Bus time limit per test: 2 seconds memory limit per test: 256 megabytes input: standard input out ...

  5. Codeforces Round #484 (Div. 2) B. Bus of Characters(STL+贪心)982B

    原博主:https://blog.csdn.net/amovement/article/details/80358962 B. Bus of Characters time limit per tes ...

  6. Codeforces Round #369 (Div. 2)---C - Coloring Trees (很妙的DP题)

    题目链接 http://codeforces.com/contest/711/problem/C Description ZS the Coder and Chris the Baboon has a ...

  7. Codeforces Round #369 (Div. 2) C. Coloring Trees(dp)

    Coloring Trees Problem Description: ZS the Coder and Chris the Baboon has arrived at Udayland! They ...

  8. Codeforces Round #436 (Div. 2) C. Bus

    http://codeforces.com/contest/864/problem/C 题意: 坐标轴上有x = 0和 x = a两点,汽车从0到a之后掉头返回,从a到0之后又掉头驶向a...从0到a ...

  9. Codeforces Round #369 (Div. 2) C. Coloring Trees(简单dp)

    题目:https://codeforces.com/problemset/problem/711/C 题意:给你n,m,k,代表n个数的序列,有m种颜色可以涂,0代表未涂颜色,其他代表已经涂好了,连着 ...

随机推荐

  1. Kinect关于PlayerIndex和SkeletonId之间的关系。

    项目中要锁定玩家骨骼后抠图, 一时没有灵感.google 关键词: the ralationship about skeletonid and playerindex. 结论: Player Segm ...

  2. 示例解读Java的跨平台原理

    首先简单的解释一下Java跨平台的特征,相当于说写一个Java程序论述上可以运行在不同的操作系统平台上面(此处的平台我们就简单的看成是操作系统平台).下面我们用一些事例来说明它的好处. 我们先了解一些 ...

  3. 《Cracking the Coding Interview》——第17章:普通题——题目3

    2014-04-28 22:18 题目:计算N的阶乘尾巴上有多少个零? 解法:计算5的个数即可,因为2 * 5 = 10,2的个数肯定比5多.计算5的个数可以在对数时间内搞定. 代码: // 17.3 ...

  4. Linux忘记root密码的解决办法

    这里以centos6为例: 第一步:先将系统重新启动,在读秒的时候按下任意键就会出现如下图的菜单界面: 第二步:按下『e』就能够进入grub的编辑模式,如图: 第三步:将光标移动到kernel那一行, ...

  5. 一个初学者的辛酸路程-前端cs

    一.主要内容 继续CSS 二.CSS 第一个: postion 网页有一类就是返回顶部,一直在右下角,还有打开一个网页顶部有个菜单,滚动滑轮,顶部永远在上面. position:  fiexd  == ...

  6. NodeJS05

    商品分类模块 分类model const mongoose = require('mongoose') const schema = new mongoose.Schema({ name: { typ ...

  7. 原始套接字--简易ping程序

    #include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> ...

  8. android 远程Service以及AIDL的跨进程通信

    在Android中,Service是运行在主线程中的,如果在Service中处理一些耗时的操作,就会导致程序出现ANR. 但如果将本地的Service转换成一个远程的Service,就不会出现这样的问 ...

  9. android自定义SlideMenu源码详解之最简单侧滑实现

    实现原理:在一个Activity的布局中需要有两部分,一个是菜单(menu)的布局,一个是内容(content)的布局.两个布局横向排列,菜单布局在左,内容布局在右.初始化的时候将菜单布局向左偏移,以 ...

  10. POJ A-Wireless Network

    http://poj.org/problem?id=2236 An earthquake takes place in Southeast Asia. The ACM (Asia Cooperated ...