任务
给定两个正整数:
- 绘制由两个整数指定的尺寸的矩形。
- 重复步骤3,直到没有更多空间。
- 绘制并填充与(剩余)矩形的三个边接触的最大正方形。
- 输出结果矩形。
例
例如,我们的输入是6
和10
。
我们绘制大小为6 x 10的空心矩形:
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
重复填充正方形后,我们将获得以下结果:
aaaaaabbbb
aaaaaabbbb
aaaaaabbbb
aaaaaabbbb
aaaaaaccdd
aaaaaaccdd
有4个方格位置(a
,b
,c
,d
),每个边长6
,4
,2
,2
分别。
规则与自由
- 您必须为每个正方形使用不同的字母。
- 您可以选择要支持的字母,只要支持的字母都是可打印字符,并且至少
10
支持字符即可。 - 在上面的步骤3的每个迭代中,您都有两个选择(在上一个迭代中,只有一个选择)。两种选择均有效。
- 所需的平方数不会超过您支持的字母数。
- 您可以按任何顺序用支持的字母填写方块。
测试用例
输入: 6, 10
输出:
aaaaaabbbb
aaaaaabbbb
aaaaaabbbb
aaaaaabbbb
aaaaaaccdd
aaaaaaccdd
要么
aaaaaaccdd
aaaaaaccdd
aaaaaabbbb
aaaaaabbbb
aaaaaabbbb
aaaaaabbbb
要么
bbbbaaaaaa
bbbbaaaaaa
bbbbaaaaaa
bbbbaaaaaa
ccddaaaaaa
ccddaaaaaa
要么
ccddaaaaaa
ccddaaaaaa
bbbbaaaaaa
bbbbaaaaaa
bbbbaaaaaa
bbbbaaaaaa
要么
ddddddaaaa
ddddddaaaa
ddddddaaaa
ddddddaaaa
ddddddbbcc
ddddddbbcc
输入: 1,1
输出:
a
输入: 1,10
输出:
abcdefghij
输入: 10,1
输出:
a
b
c
d
e
f
g
h
i
j
请注意,以上测试用例包含的可能性比我能提供的更多。
计分
这是代码高尔夫球。以字节为单位的最短答案将获胜。
相关的。
—
Leaky Nun