3月13日被认为是“ 国家珠宝节”,这是这一挑战的主题。所以,给定一个整数n
,其中n
大于0,创建一个ASCII宝石。例如:
n = 1 n = 2 n = 3
______
____ / \
__ / \ \ /
/ \ \ / \ /
\ / \ / \ /
\/ \/ \/
底部定义为珠宝中最高的一对\/
。其余的是顶部。对于上面的示例,其中n = 1
:
Bottom: \ / Top: __
\/ / \
如您所见,底部由n + 1
多层构成,\/
中间各层之间有(1 * lines from the bottom) * 2
间隔,n
距珠宝底部的线条最大。如果我们拿第二个珠宝(n = 2
),我们可以看到:
____
/ \
\ / 2 (or n) layers from the bottom with 1*2*2 or 4 spaces in between \/
\ / 1 layer from the bottom with 1*1*2 or 2 spaces in between \/
\/ The bottom (0 layers) with 1*0*2 spaces or 0 spaces in between \/
顶部由1对的/\
与n*2
在之间的空间与n*2
在顶部下划线。
规则
- 必须能够接受任何非零的正整数作为用户输入
- 必须创建具有上述规格的珠宝(此处重述):
- 顶部由1对的
/\
与n*2
在之间的空间与n*2
在顶部下划线。 - 底部由
n + 1
层间的层组成,\/
中间有(1 * lines from the bottom) * 2
间隔,n
距珠宝底部的线条最大。
- 顶部由1对的
- 可以在珠宝后尾随换行符,也可以在每行尾随空格。
- 不允许出现标准漏洞
获奖标准
最小字节获胜!