目前,在我的工作中,我们搬到了新建筑物。它应该是最先进的,并具有自动照明,自动卷帘百叶窗,现在被称为该镇最环保的建筑。
但是,它并不是真的工作得很好。.阴天有时会卷起百叶窗,当太阳开始发光时会向上卷起,并且有时每隔5-10次交替打开和关闭,灯光有时会导致迪斯科效果分钟。另外,我们没有任何手动方式来控制这些下拉式百叶窗,也没有温度,但是我们确实有一个遥控器来控制灯光。
但是,这些遥控器没有说明手册,并且包含20多个按钮,用于执行除您似乎需要的操作之外的所有操作。
PS:我在1.5个月前在沙盒中编写了此挑战。目前,我们有点了解遥控器的工作原理。.
这栋建筑的一大优势是,室外温度为摄氏30度以上,而内部温度始终保持在21摄氏度。
因此,这就是介绍,灯光的遥控器激发了这一挑战。
挑战:
假设我们最初关闭了灯:
L
然后我们按下所有按钮,然后输出灯的状态。
对于灯泡遥控器的不同功能,我们使用以下数字。当该数字前面有减号时,我们做相反的事情。
1
=开;-1
=关。2
=增加力量25%;-2
=降低(昏暗)强度25%。3
=点差增加50%;-3
=减少点差50%。4
=切换灯光类型。
所以,这一切都非常模糊,因此让我们更深入地了解每件事的含义:
因此,-1
(OFF)很明显,1
它将进入初始的ON状态(表示为50%,表示为2
50%3
):
//
//
L ====
\\
\\
2
以及-2
光的传播距离(==
每25%附加一个):
0% (equal to a light bulb that is OFF)
L
25%
L ==
50%
L ====
75%
L ======
100%
L ========
3
并且-3
是光差多远:
0%:
L ====
50%:
//
//
L ====
\\
\\
100%:
|| //
||//
L ====
||\\
|| \\
(注意:当2
和3
都为100%时,您将处于以下状态:
|| //
|| //
|| //
||//
L ========
||\\
|| \\
|| \\
|| \\
4
是切换灯光类型。
Default:
//
L ==
\\
After toggling (note the single space before '/' instead of two):
/
L --
\
输入:
您将收到包含可能的按钮按下的输入。例如:
12-34
输出:
依次按输入的所有按钮后,指示灯的状态。因此,使用上面的示例输入,我们得到以下输出:
L ------
挑战规则:
- 输入仅包含
1234-
(且-
之前不包含4
)。 - 您永远不能低于0%或高于100%。如果数字会超出这些界限而增加/减少,则可以忽略它。
- 灯泡熄灭时,您可以忽略任何操作,再次打开灯泡时,它将重置为初始ON状态(
2
和均为50%3
,默认为4
)。例如:12-1-341
将仅打印上述初始ON状态。(提示:您可以忽略最后1
输入之前的所有内容-除外-1
。) - 尾随空格等于灯的长度或一条尾随新行不受限制。但是,没有添加多余的新行。
- 您可以将输入作为整数列表而不是单个字符串。因此
12-34
,可以代替[1,2,-3,4]
输入。
一般规则:
- 这是代码高尔夫球,因此最短答案以字节为单位。
不要让代码高尔夫球语言阻止您使用非代码高尔夫球语言发布答案。尝试针对“任何”编程语言提出尽可能简短的答案。 - 标准规则适用于您的答案,因此允许您使用STDIN / STDOUT,具有适当参数的函数/方法,完整程序。你的来电。
- 默认漏洞是禁止的。
- 如果可能的话,请添加一个带有测试代码的链接。
- 另外,如有必要,请添加说明。
测试用例:
12-34
L ------
12-1-341
//
//
L ====
\\
\\
14-3224333-2
|| //
|| //
||//
L ======
||\\
|| \\
|| \\
142-1-314-3-322
L --------
1324-2-3
/
/
L ----
\
\
134
| /
|/
L ----
|\
| \
1-2-2-214-3-3-3
L ----
4
)。感谢您的询问。
1
按下了指示灯,是否重置参数?
134
什么?