在我的语言Pyramid Scheme中,有一个稍微有趣的结构:空三角形:
^
-
如果不提供任何参数,则返回0
。要1
使用此构造生成,可以使用以下代码:
^
/!\
^---
-
这只是传递0
给求反函数。我们可以继续否定这个结果:
^
/!\
---^
/!\
^---
-
得出0。又一个否定给出:
^
/!\
^---
/!\
---^
/!\
^---
-
挑战
给定的整数Ñ ≥1,输出空金字塔被否定Ñ在所描述的方式倍。
测试用例
input
output
1
^
/!\
^---
-
2
^
/!\
---^
/!\
^---
-
3
^
/!\
^---
/!\
---^
/!\
^---
-
6
^
/!\
---^
/!\
^---
/!\
---^
/!\
^---
/!\
---^
/!\
^---
-
@ user202729不,我的意思是定期否定。
—
科纳·奥布莱恩
因此是C / C ++
—
user202729
!
(not
)。
@ user202729是的。尽管这意味着与问题相切
—
Conor O'Brien
/!\ 警告!/!\我到处都看到警告三角形!
—
RedClover
~
)?