QOJ.ac

QOJ

حد الوقت: 1 s حد الذاكرة: 256 MB مجموع النقاط: 100

#3548. 国际象棋棋局

الإحصائيات

你有无限数量的白棋和黑棋,棋子种类包括后(queen)、象(bishop)、马(knight)和车(rook)。给定两个数字 $w$ 和 $b$,分别表示必须处于被攻击状态下的白棋和黑棋的数量。你需要在一个 $8 \times 8$ 的棋盘上摆放棋子,以满足上述限制。

后、象和车在允许的方向上移动,直到遇到另一个棋子,如果该棋子颜色不同,则可以攻击它。马也可以攻击颜色不同的棋子,并且可以跳过其他棋子。

输入格式

第一行包含一个整数 $t$ —— 测试用例的数量。接下来的 $t$ 行,每行包含两个整数 $w$ 和 $b$ —— 分别表示处于被攻击状态的白棋和黑棋的数量。

$1 \le t \le 10^3$ $0 \le w, b \le 50$ $w + b \le 64$

输出格式

对于每个测试用例,你需要输出一个满足给定条件的棋盘布局。棋盘应表示为 8 行,每行 8 个字符。不同测试用例的输出之间应以空行分隔。空单元格用 '.' 表示,后用 'q' 表示,象用 'b' 表示,马用 'k' 表示,车用 'r' 表示。白棋用大写字母表示,黑棋用小写字母表示。如果存在多个正确的布局,你可以输出其中任意一个。题目保证正确答案一定存在。

样例

输入格式 1

2
2 3
4 2

输出格式 1

Q.b...rR
....K...
........
.....b..
........
..k.....
.k......
......Q.

........
Q.k...Q.
........
...k....
..r..B..
....BkK.
.....K..
..K.K...

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.