我很累,但似乎无法入睡。帮我数羊。
给定输入N(正整数),使N只羊跳过ascii栅栏,如以下示例所示。一次只能显示一帧:
o |-|
──|-|── 0
o|-|
──|-|── 0
o
|-|
──|-|── 0
|-|o
──|-|── 0
|-| o
──|-|── 0
o |-|
──|-|── 1
o|-|
──|-|── 1
o
|-|
──|-|── 1
计数应保持在“地面”的右下角。允许尾随和前导空格以及换行符。如果您选择的语言难以清除每一帧的屏幕,则可以添加足够的换行符来清除屏幕-请在回答中说明为此添加的行数。该程序应在第N只羊位于第五层时终止。
我明天需要早起,所以以字节为单位的最短代码会获胜。请提交功能或完整程序。有标准漏洞。
N=3
最后一帧的右端将包含一只羊,而计数器仍会说2
。那是对的吗?