A. DZY Loves Chessboard

来源:互联网 发布:php财务管理系统 编辑:程序博客网 时间:2024/04/25 05:19
A. DZY Loves Chessboard
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

DZY loves chessboard, and he enjoys playing with it.

He has a chessboard of n rows and m columns. Some cells of the chessboard are bad, others are good. For every good cell, DZY wants to put a chessman on it. Each chessman is either white or black. After putting all chessmen, DZY wants that no two chessmen with the same color are on two adjacent cells. Two cells are adjacent if and only if they share a common edge.

You task is to find any suitable placement of chessmen on the given chessboard.

Input

The first line contains two space-separated integers n and m (1 ≤ n, m ≤ 100).

Each of the next n lines contains a string of m characters: the j-th character of the i-th string is either "." or "-". A "." means that the corresponding cell (in the i-th row and the j-th column) is good, while a "-" means it is bad.

Output

Output must contain n lines, each line must contain a string of m characters. The j-th character of the i-th string should be either "W", "B" or "-". Character "W" means the chessman on the cell is white, "B" means it is black, "-" means the cell is a bad cell.

If multiple answers exist, print any of them. It is guaranteed that at least one answer exists.

Sample test(s)
input
1 1.
output
B
input
2 2....
output
BWWB
input
3 3.-.-----.
output
B-B-----B
Note

In the first sample, DZY puts a single black chessman. Of course putting a white one is also OK.

In the second sample, all 4 cells are good. No two same chessmen share an edge in the sample output.

In the third sample, no good cells are adjacent. So you can just put 3 chessmen, no matter what their colors are.


12345678910111213141516171819202122232425262728293031
#include<stdio.h>#include<string.h>char s[200][200];int main(){    int n, m, i, j;    scanf("%d%d", &n, &m);    for(int i=0; i<n; i++)    {        scanf("%s", s[i]);    }    for(int i=0; i<n; i++)    {        for(int j=0; j<m; j++)        {            if(s[i][j]=='-')            {                printf("-");                continue;            }            if((i+j)%2)                printf("B");            else                printf("W");        }        printf("\n");    }    return 0;

0 0
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 京东账号手机号换了怎么办 换手机号了淘宝账号怎么办 qq登录id密码忘记怎么办 iphone商店密码忘记了怎么办 淘宝账号被限制登入怎么办 手机换号码了qq登不上怎么办 换手机了qq登不上怎么办 微信帐号和密码错误怎么办 高考生忘记登录密码怎么办 高考生登录密码丢了怎么办 高考志愿登录密码忘了怎么办 电视声音和画面不同步怎么办 苹果5s不能开机怎么办 红米手机老是闪退怎么办 苹果7plus打字卡怎么办 手机总是出现无响应怎么办 手机淘宝怎么打不开了怎么办 淘宝买东西卖家不同意退货怎么办 苹果自带浏览器不能上网怎么办 淘宝账号买不了东西怎么办 支付宝被限制登录怎么办 微信登录不上 钱怎么办 淘宝账号买家权限被限制怎么办 淘宝中店新品打不开怎么办 旺旺号被限制有退款怎么办 登陆微信收不到验证码怎么办 淘宝店注册成功后怎么办 充电宝掉进水里怎么办 空光盘读不出来怎么办 苹果8plus丢了怎么办 苹果8plus掉了怎么办 淘宝账户被限制使用怎么办 飞利浦电脑显示器黑屏怎么办打开 微信忘记密码手机号停用怎么办 淘宝账号登录密码忘记了怎么办 淘宝支付密码输错了怎么办 淘宝支付密码忘记了怎么办 淘宝货品上架后显示过期怎么办 被淘宝客监控了怎么办 助学贷款支付宝账号忘记怎么办 离婚支付宝的钱怎么办