2345. Youth Hostel Dorm

单点时限: 2.0 sec

内存限制: 256 MB

The Utrecht Youth Hostel has a giant dorm which usually accommodates all customers easily. With nwerc in town, however, lots of people would like to stay there and all the space available in the dorm should be used as efficiently as possible. You are assigned to provide the dorm layout.

The size of the dorm is given and the layout should consist of a map of that particular size. The map should display one E, the point of entrance of the dorm, and furthermore Bs and .s, indicating beds and empty spaces. The entrance should be located somewhere on the boundary of the dorm and every single bed should be reachable by starting at the entrance and walking through empty squares only. You can only walk in vertical and horizontal directions.

The provided layout should contain as many beds as possible.

输入格式

On the first line one positive number: the number of testcases, at most $100$. After that per testcase:

  • One line with two integers $l$ and $w$ with $1 \le l, w \le 8$: the size of the dorm.

输出格式

Per testcase:

  • $l$ lines with $w$ characters: the dorm layout. Any layout with the maximum number of beds is correct.

样例

Input
3
1 1
4 7
3 8
Output
E
B.B.BEB
B.BBB.B
B.....B
B.BBB.B
BBBBBBBB
.......E
BBBBBBBB

1 人解决,4 人已尝试。

1 份提交通过,共有 8 份提交。

9.9 EMB 奖励。

创建: 16 年,5 月前.

修改: 6 年,3 月前.

最后提交: 3 年,5 月前.

来源: Northwestern Europe 2007

题目标签