欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1221B.Knights
Knights
You are given a chess board with rows and columns. Initially all cells of the board are empty, and you have to put a white or a black knight into each cell of the board.
A knight is a chess piece that can attack a piece in cell (, ) from the cell (, ) if one of the following conditions is met:
- and , or
- and .
Here are some examples of which cells knight can attack. In each of the following pictures, if the knight is currently in the blue cell, it can attack all red cells (and only them).

A duel of knights is a pair of knights of different colors such that these knights attack each other. You have to put a knight (a white one or a black one) into each cell in such a way that the number of duels is maximum possible.
Input
The first line contains one integer () — the number of rows (and columns) in the board.
Output
Print lines with characters in each line. The -th character in the -th line should be W, if the cell (, ) contains a white knight, or B, if it contains a black knight. The number of duels should be maximum possible. If there are multiple optimal answers, print any of them.
Note
In the first example, there are duels:
- the white knight in (, ) attacks the black knight in (, );
- the white knight in (, ) attacks the black knight in (, );
- the white knight in (, ) attacks the black knight in (, );
- the white knight in (, ) attacks the black knight in (, );
- the white knight in (, ) attacks the black knight in (, );
- the white knight in (, ) attacks the black knight in (, );
- the white knight in (, ) attacks the black knight in (, );
- the white knight in (, ) attacks the black knight in (, ).
Samples
3
WBW
BBB
WBW
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |