背景故事
认识我的朋友吉米:
/o\
吉米(Jimmy)是一个小人物,喜欢站在平台上。这是吉米安全地站在平台上的地方:
/o\
-------------
现在,吉米已经有了很好的平衡感,因此他可以放下一只脚,安全地站起来,就像这样:
/o\
-------------------
尽管如果他站着两个或更多身体部位离开平台,他将跌倒。这两个都是吉米将倒下的例子:
/o\ /o\
---------- ----------------------
挑战
您面临的挑战是编写一个程序,在给出吉米平台和位置的字符串的情况下,确定吉米是否可以站在平台上而不脱落。
输入:两行显示Jimmy的位置和他下面平台的位置。这可以来自两个单独的输入,单个输入或某种数组。
- 您可以通过任何合理的形式接受输入,包括功能和标准输入。如果您的语言不支持其他输入法,则仅求助于硬编码。
输出:布尔值true和false,或者整数1或0分别表示true / false。
- 布尔值取决于Jimmy是否可以留在平台上-如果Jimmy可以留在平台上,则为true;如果他会跌落,则为false。
平台大小是任意的,可以随意更改。您的程序应说明这一点。
平台的长度不能为零,并且平台必须完整(平台上没有孔)。
请记住,吉米的两个身体部位悬在平台上时会掉下。身体部位是他身体的一个ASCII字符。
在平台末尾不需要尾随空格,但是您的程序应考虑两种情况,即平台后面有空格而没有空格。
注意标准漏洞禁止。
测试用例
/o\ ✔️ TRUE
-------------
/o\ ✔️ TRUE
----------
/o\ ❌ FALSE
------------------
/o\ ❌ FALSE
-------
/o\ ❌ FALSE
-
计分
这是代码高尔夫球,因此最低字节数为准。
排行榜
您可以通过展开下面的小部件/片段来查看此帖子的页首横幅。为了使您的帖子包含在排名中,您需要一个# header text
带有以下信息的标题():
语言名称(以逗号
,
或破折号结尾-
),后跟...。字节数,作为出现在标题中的最后一个数字。
例如,JavaScript (ES6), 72 bytes
有效但Fortran, 143 bytes (8-bit)
无效,因为字节数不是标头中的最后一个数字(您的答案将被识别为8个字节-请勿利用此字节)。
<!-- Run the snippet to see the leaderboard. Report any bugs to @xMikee1 on Github --> <iframe src="https://xmikee1.github.io/ppcg-leaderboard/?id=187586" width="100%" height="100%" style="border:none;">Oops, your browser is too old to view this content! Please upgrade to a newer version of your browser that supports HTML5.</iframe><style>html,body{margin:0;padding:0;height:100%;overflow:hidden}</style>