QOJ.ac

QOJ

حد الوقت: 1 s حد الذاكرة: 1024 MB مجموع النقاط: 33

#5814. Snapper Chain

الإحصائيات

Snapper 是一种巧妙的小装置,它的一侧可以插入电源插座,另一侧则提供一个插座供灯泡或其他设备使用。

当一个 Snapper 处于 ON(开启)状态且其输入端有电时,连接在其输出端的设备也会获得电力。当你打响指时(发出咔哒声),所有在打响指瞬间处于通电状态的 Snapper 都会在 ON 和 OFF 状态之间切换。

为了通过奇点摧毁宇宙,我购买了 $N$ 个 Snapper 装置,并将它们串联起来:第一个插入电源插座,第二个插入第一个的输出端,以此类推。灯泡则插入第 $N$ 个 Snapper 的输出端。

最初,所有的 Snapper 都处于 OFF 状态,因此只有第一个 Snapper 从插座获得电力,灯泡是熄灭的。我打了一次响指,这使得第一个 Snapper 切换到 ON 状态,并给第二个 Snapper 供电。我再次打响指,这使得两个 Snapper 都发生切换,并立即切断了第二个 Snapper 的电源,使其保持在 ON 状态,但没有电力。我第三次打响指,第一个 Snapper 再次切换并给第二个 Snapper 供电。此时两个 Snapper 都处于 ON 状态,如果灯泡插在第二个 Snapper 上,它就会亮起。

我不断重复这个过程。请问在我打了 $K$ 次响指后,灯泡是亮着(ON)还是熄灭(OFF)的?灯泡亮起当且仅当它从所连接的 Snapper 获得电力。

样例

输入格式 1

4
1 0
1 1
4 0
4 47

输出格式 1

Case #1: OFF
Case #2: ON
Case #3: OFF
Case #4: ON

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.