CF1333A.Little Artem
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Young boy Artem tries to paint a picture, and he asks his mother Medina to help him. Medina is very busy, that's why she asked for your help.
Artem wants to paint an n×m board. Each cell of the board should be colored in white or black.
Lets B be the number of black cells that have at least one white neighbor adjacent by the side. Let W be the number of white cells that have at least one black neighbor adjacent by the side. A coloring is called good if B=W+1.
The first coloring shown below has B=5 and W=4 (all cells have at least one neighbor with the opposite color). However, the second coloring is not good as it has B=4, W=4 (only the bottom right cell doesn't have a neighbor with the opposite color).

Please, help Medina to find any good coloring. It's guaranteed that under given constraints the solution always exists. If there are several solutions, output any of them.
小男孩阿尔泰姆试图画一幅画,他请妈妈梅迪娜帮忙。梅迪娜非常忙,因此她请求你的帮助。
阿尔泰姆想给一个 n×m 的方格板上色,每个格子必须涂成白色或黑色。
设 B 为至少有一个与之边相邻的白色邻居的黑色格子的数量;
设 W 为至少有一个与之边相邻的黑色邻居的白色格子的数量。
若一种着色满足 B=W+1,则称其为好着色。
下方所示的第一种着色中,B=5、W=4(所有格子均至少有一个颜色相反的邻格)。然而,第二种着色不是好着色,因为此时 B=4、W=4(仅右下角格子没有颜色相反的邻格)。

请帮助梅迪娜找出任意一种好着色。在给定约束条件下,解一定存在。若有多种解,输出任意一种即可。
输入格式
Each test contains multiple test cases.
The first line contains the number of test cases t (1≤t≤20). Each of the next t lines contains two integers n,m (2≤n,m≤100) — the number of rows and the number of columns in the grid.
每个测试包含多个测试用例。
第一行包含测试用例的数量 t(1≤t≤20)。接下来的 t 行中,每行包含两个整数 n,m(2≤n,m≤100)—— 分别表示网格的行数和列数。
输出格式
For each test case print n lines, each of length m, where i-th line is the i-th row of your colored matrix (cell labeled with 'B' means that the cell is black, and 'W' means white). Do not use quotes.
It's guaranteed that under given constraints the solution always exists.
对每个测试用例,输出 n 行,每行长度为 m,其中第 i 行为你所构造的着色矩阵的第 i 行(标记为 'B' 的格子表示该格子为黑色,'W' 表示白色)。不要使用引号。
在给定约束条件下,保证解一定存在。
输入输出样例
输入#1
2 3 2 3 3
输出#1
BW WB BB BWB BWW BWB
说明/提示
In the first testcase, B=3, W=2.
In the second testcase, B=5, W=4. You can see the coloring in the statement.
在第一个测试用例中,B=3,W=2。
在第二个测试用例中,B=5,W=4。你可以在题目描述中看到对应的染色方案。
输入解题思路,AI测评打分。不知道怎么写?