您需要从多维数据集构建金字塔。多维数据集可以从2个角度查看:
_____ _____
/\ \ / /\
/ \____\ /____/ \
\ / / \ \ /
\/____/ \____\/
这是从2个可能角度的2尺寸立方体的示例。多维数据集的高度为$size
斜杠(或反斜杠),而多维数据集的宽度为2 * $size
下划线。顶层宽度应包含一个额外的下划线字符。
输入将以包含数字(立方体大小),斜杠或反斜杠(指示方向/角度)以及另一个数字(金字塔高度)的字符串形式提供。
例子:
输入:
1/1
输出:
___
/\__\
\/__/
输入:
1\1
输出:
___
/__/\
\__\/
输入:
2/1
输出:
_____
/\ \
/ \____\
\ / /
\/____/
输入:
1/2
输出:
___
___/\__\
/\__\/__/
\/__/\__\
\/__/
输入:
2\2
输出:
_____
/ /\
/____/ \_____
\ \ / /\
\____\/____/ \
/ /\ \ /
/____/ \____\/
\ \ /
\____\/
输入:
1/3
输出:
___
___/\__\
___/\__\/__/
/\__\/__/\__\
\/__/\__\/__/
\/__/\__\
\/__/
- 尾随/前导空格可以。
- 不允许出现标准漏洞。
- 您可以假设输入将始终有效。
- 您可能会认为输入不会导致太大的输出,即:当输出被打印到终端时没有换行。
- 立方体的大小和金字塔的高度为正(即≥1)
- 这是代码高尔夫球,因此以字节为单位的最短代码获胜。
目前的优胜者是:
茱莉亚(Julia)中的270字节的Glen O
挑战保持开放。如果您击败了目前最好的,我将更新接受的答案。