QOJ.ac

QOJ

Límite de tiempo: 2.0 s Límite de memoria: 2048 MB Puntuación total: 100

#16049. 定时炸弹

Estadísticas

你和你在当地警察局防爆小组的队友们被召集去拆除在镇上唯一一家酒馆里发现的炸弹。由于担心这可能带来的悲惨后果,你们尽快赶到了现场。经过一番研究,你们了解到坏人们设计了一种狡猾的方法,允许他们随意拆除炸弹。你找到了一个带有按钮的遥控器,可以带到安全的地方。你还发现可以通过无线连接与炸弹相连,并每 $2$ 秒获取一次该密码的 ASCII 艺术表示。如果当密码是一个能被 $6$ 整除的数字时按下按钮,炸弹就会被拆除。但你必须小心:如果当密码的 ASCII 表示不是一个能被 $6$ 整除的数字,或者其中任何一个数字的表示无效时按下按钮,炸弹就会爆炸。你必须依靠你的编程技能编写一个程序,在酒馆(和啤酒)被炸飞之前,告诉你现在按下按钮是否安全。

输入格式

输入包含一个密码的 ASCII 艺术表示。该密码包含 $2$ 到 $8$ 个数字。每个数字由 $5$ 行 $3$ 列的字符表示,字符可以是空格或星号 *。输入中不会出现其他类型的字符(换行符除外)。每个数字之间由一列空格(且仅有空格)隔开。在最后一个数字之后是一个换行符。请注意,尽管每个数字的大小总是 $5 \times 3$,但并不能保证它一定代表 $0$ 到 $9$ 之间(闭区间)的一个有效数字。每个数字的有效 $5 \times 3$ 表示如图 1 所示。

### ### ### ### ### ### ### ### ### ###
***   * *** *** * * *** *** *** *** ***
* *   *   *   * * * *   *     * * * * *
* *   * *** *** *** *** ***   * *** ***
* *   * *     *   *   * * *   * * *   *
***   * *** ***   * *** ***   * *** ***

图 1:顶部的井号 # 字符仅用于标记一个数字所占用的 $3$ 列,不属于数字表示的一部分。

密码可以有前导零,例如,00000076 的 ASCII 表示代表数字 $76$。你也可以安全地假设每个有效的密码都对应一个严格的正数。

输出格式

如果按下按钮拆除炸弹是安全的,输出一行 BEER!!;否则,输出 BOOM!!

样例

输入样例 1

***   * * * *** *** *** ***
* *   * * *   *   *   *   *
* *   * *** *** *** *** ***
* *   *   *   * * *   *   *
***   *   * *** *** *** ***

输出样例 1

BEER!!

输入样例 2

* * *** *** *** * *
* *  **   *   * * *
* * *** *** *** ***
* *   *   *   *   *
* * *** *** *** *

输出样例 2

BOOM!!

输入样例 3

*** *** * *** *** *
* *   * *   *   * *
*** * * * *** *** *
* *   * *   *   *  
*** *** * *** *** *

输出样例 3

BOOM!!

输入样例 4

*** *** *** * * ***
* *   *   * * *   *
*** * *** *** ***  
* *   *   *   * *  
*** * *** * ***

输出样例 4

BEER!!

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.