133A - HQ9+
来源:互联网 发布:知行论坛pt 编辑:程序博客网 时间:2024/04/27 17:55
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.
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.
Output "YES", if executing the program will produce any output, and "NO" otherwise.
Hi!
YES
Codeforces
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.
s=gets.chompif s['H']||s['Q']||s['9'] puts 'YES'else puts 'NO'end
- CodeForces-133A-HQ9+
- 133A - HQ9+
- 133A - HQ9+
- CF 133A HQ9+
- codeforces 133A HQ9+
- CodeForces 133A A. HQ9+
- A. HQ9+
- Problem--133A--Codeforces--A. HQ9+
- codeforces 133A(HQ9+) Java
- CodeForces 133 A.HQ9+(水~)
- codeforces 133A HQ9+(字符串水题)
- Codeforces刷题之路——133A HQ9+
- HQ9+
- a
- a
- a
- a
- a
- C++ Builder 开发DLL项目
- Visual Studio 2013 官方免费社区版/简体中文旗舰版下载 (VS2013 MSDN原版ISO镜像)
- centos 6.5安装zebra-0.95
- 算法导论--学习笔记010
- hdoj进制转换
- 133A - HQ9+
- BZOJ 2219 数论之神 数论
- SDRAM的地址映射方式BRC(Bank Row Column)和RBC(Row Bank Column)
- loop & butterfly subdivison
- 编写程序,求出并输出1000以内的所有的素数
- Linux用户空间随上下文切换而发生改变
- RL-RTX SVC 函数: unprivileged模式下运行的任务如何修改要求privileged权限的寄存器
- 第14周项目一 折腾二维数组
- ASP.NET之JSONHelper操作