介绍
这个想法是使用星号(星号)*
在指定的尺寸上显示一个ascii-art星。维度是一个大于或等于的输入数字,用于指定星形的上点的高度。这里的星星是六颗尖的星星,从图片的角度看,它们的大小更大。
在所有情况下,恒星的ascii-art表示都应显示为两个重叠的三角形,如以下示例所示。
参数化
下图和数据表描述了星形的前七个尺寸的属性。每个参数随着增加以算术级数增长,除了不同。
例子
对于输入1(简并的情况),程序输出应如下所示:
*
*****
*****
*
输入2:
*
***
*********
*******
*********
***
*
(3)
*
***
*****
***************
*************
***********
*************
***************
*****
***
*
(5)
*
***
*****
*******
*********
***************************
*************************
***********************
*********************
*******************
*********************
***********************
*************************
***************************
*********
*******
*****
***
*
挑战
您的任务是创建一个将接受数字N作为输入的函数或程序,然后仅使用字符和
*
字符输出适当大小的星形。
- 您可以假设输入值始终为正整数。
- 输出行上的尾随空白可以。
- 程序算法对于任何输入都应足够通用,以产生星图输出。当然,由于显示器输出尺寸的原因,存在实际限制。
- 输出应打印到STDOUT。
- 禁止出现标准漏洞。
- 这是代码高尔夫球,因此所有常规高尔夫球规则都适用。
计分
这是代码高尔夫球,因此字节数最短的代码胜出!