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. 《Cracking the Coding Interview》——第8章:面向对象设计——题目3

    2014-04-23 18:10 题目:设计一个点唱机. 解法:英文叫Musical Jukebox.这是点唱机么?卡拉OK么?这种题目实在是云里雾里,又没有交流的余地,我索性用一个vector来表示 ...

  2. windows上php环境下memcache和mongodb的安装

    mangodb安装 1. 下载mongodb的安装文件,我安装的windows 64位的,下载地址如下: https://fastdl.mongodb.org/win32/mongodb-win32- ...

  3. IIS Express mime type 列表。

    C:\Users\Administrator\Documents\IISExpress\config\applicationhost.config -------------------------- ...

  4. 自动化测试学习之路--json、dom编程

    1.json: json是JavaScript Object Notation,是一种数据传输格式. 以下程序都是在浏览器的Console下执行的. 创建一个javaScript的对象: var st ...

  5. Python 两种方式实现斐波那契数列

    斐波那契数列指的是这样一个数列 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233,377,610,987,1597,2584,4181,6765,10946 ...

  6. selenium初识(二)——之webdriver API

    配置完的环境之后,我们先来写一个小脚本: # __Author__:"Jim_xie" from selenium import webdriver from time impor ...

  7. Asp.net获取网站绝对路径的几种方法

    在编写ASP.NET应用程序的时候,有时候为了更好的进行控制静态文件的路径,以及网站部署过程中的虚拟路径等问题,采用绝对路径避免资源出现Not Found,下面先看看几种获取绝对路径的方法: 1. 以 ...

  8. Python全栈 MySQL 数据库 (引擎、事物、pymysql模块、orm)

    ParisGabriel              每天坚持手写  一天一篇  决定坚持几年 为了梦想为了信仰    开局一张图     存储引擎(处理表的处理器)     基本操作:         ...

  9. 【bzoj2038】[2009国家集训队]小Z的袜子(hose) 莫队算法

    原文地址:http://www.cnblogs.com/GXZlegend/p/6803860.html 题目描述 作为一个生活散漫的人,小Z每天早上都要耗费很久从一堆五颜六色的袜子中找出一双来穿.终 ...

  10. [NOI2015][bzoj4197] 寿司晚宴 [状压dp+质因数]

    题面 传送门 思路 首先,要让两个人选的数字全部互质,那么有一个显然的充要条件:甲选的数字的质因数集合和乙选的数字的质因数集合没有交集 30pt 这种情况下n<=30,也就是说可用的质数只有10 ...