-
Notifications
You must be signed in to change notification settings - Fork 0
/
A. Little Artem.cpp
60 lines (44 loc) · 1.17 KB
/
A. Little Artem.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include <bits/stdc++.h>
using namespace std;
#define _ ios_base::sync_with_stdio(0); cin.tie(0);
int main() { _
int n, r, c;
cin >> n;
while (n--)
{
cin >> r >> c;
bool row = false, col = false;
if (!(r % 2)) row = true;
else if (!(c % 2)) col = true;
for (int i = 0; i < r; i++)
{
for (int j = 0; j < c; j++)
{
if (row)
{
if(!(i % 2) || (j == 0 && i == 1)) cout << 'B';
else cout << 'W';
}
else if (col)
{
if(!(j % 2) || (i == 0 && j == 1)) cout << 'B';
else cout << 'W';
}
else
{
if (i == 0)
{
if (!(j % 2)) cout << 'B';
else cout << 'W';
}
else
{
if (i % 2) cout << 'B';
else cout << 'W';
}
}
}
cout << '\n';
}
}
}