CF133A.HQ9+

入门

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

HQ9+ is a joke programming language which has only four one-character instructions:

  • "H" prints "Hello, World!",
  • "Q" prints the source code of the program itself,
  • "9" prints the lyrics of "99 Bottles of Beer" song,
  • "+" increments the value stored in the internal accumulator.

Instructions "H" and "Q" are case-sensitive and must be uppercase. The characters of the program which are not instructions are ignored.

You are given a program written in HQ9+. You have to figure out whether executing this program will produce any output.

HQ9+ 是一种玩笑性质的编程语言,仅包含四条单字符指令:

  • “H” 输出 “Hello, World!”;
  • “Q” 输出该程序自身的源代码;
  • “9” 输出歌曲《99 Bottles of Beer》的歌词;
  • “+” 对内部累加器中存储的值加 1。

指令 “H” 和 “Q” 区分大小写,必须为大写字母。程序中所有非指令的字符均被忽略。

现给出一段用 HQ9+ 编写的程序,请判断执行该程序是否会生成任何输出。

输入格式

The input will consist of a single line p which will give a program in HQ9+. String p will contain between 1 and 100 characters, inclusive. ASCII-code of each character of p will be between 33 (exclamation mark) and 126 (tilde), inclusive.

输入将仅包含一行字符串 pp,表示一个 HQ9+ 程序。字符串 pp 的长度为 11 到 100100 个字符(含端点)。pp 中每个字符的 ASCII 码值均在 3333(感叹号 !)到 126126(波浪号 ~)之间(含端点)。

输出格式

Output "YES", if executing the program will produce any output, and "NO" otherwise.

如果执行该程序会产生任何输出,则输出 “YES”,否则输出 “NO”。

输入输出样例

  • 输入#1

    Hi!

    输出#1

    YES
  • 输入#2

    Codeforces

    输出#2

    NO

说明/提示

In the first case the program contains only one instruction — "H", which prints "Hello, World!".

In the second case none of the program characters are language instructions.

在第一种情况下,程序仅包含一条指令——“H”,它会输出“Hello, World!”。

在第二种情况下,程序中的字符均不是该语言的指令。

输入解题思路,AI测评打分。不知道怎么写?

首页