编写一个命名函数或程序,该函数或程序接受单个整数N并打印(至STDOUT)或返回(作为字符串)下面螺旋的前N个条,从中心的竖线开始并顺时针向外螺旋。
_______________
/ _____________ \
/ / ___________ \ \
/ / / _________ \ \ \
/ / / / _______ \ \ \ \
/ / / / / _____ \ \ \ \ \
/ / / / / / ___ \ \ \ \ \ \
/ / / / / / / _ \ \ \ \ \ \ \
/ / / / / / / / \ \ \ \ \ \ \ \
| | | | | | | | | | | | | | | |
\ \ \ \ \ \ \___/ / / / / / / /
\ \ \ \ \ \_____/ / / / / / /
\ \ \ \ \_______/ / / / / /
\ \ \ \_________/ / / / /
\ \ \___________/ / / /
\ \_____________/ / /
\_______________/ /
您可以假设0 <N <=278。您的输出不能在螺线的最左字符前面包含任何空格。您可以选择打印单个尾随换行符。
对于输入10,正确的输出是
_
/ \
| |
\___/
对于输入2,正确的输出是
/
|
对于20的输入,正确的输出为
___
/ _ \
/ / \ \
| | | |
\___/ /
因为最左边的字符前面有空格,所以输出不正确是
___
/ _ \
/ / \ \
| | | |
\___/ /
获胜者为最短提交,以字节为单位。
这是一个怪异的螺旋,每转6/8边变大,而2个仍保持大小1
—
Devon Parsons
@DevonParsons认为它具有六边形螺旋,其中竖线(
—
mbomb007'3
|
)只是可以表示a /
和的相交的最接近的字符\
。