1. 程式人生 > >Problem--133A--Codeforces--A. HQ9+

Problem--133A--Codeforces--A. HQ9+

A. HQ9+
time limit per test2 seconds
memory limit per test256 megabytes
inputstandard input
outputstandard output

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.

Input
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
Output “YES”, if executing the program will produce any output, and “NO” otherwise.

Examples
input
Hi!
output
YES
input
Codeforces
output
NO

Note
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.

#include<stdio.h>
int main()
{
    char str;
    while(str!='\n')
    {
        scanf("%c",&str);
        if(str=='H'||str=='Q'||str=='9'){
            printf("YES\n");
            return 0;
        }
    }
    printf("NO\n");
    return 0;
}

相關推薦

Problem--133A--Codeforces--A. HQ9+

A. HQ9+ time limit per test2 seconds memory limit per test256 megabytes inputstandard inp

Problem--112A--Codeforces--A. Petya and Strings

A. Petya and Strings time limit per test2 seconds memory limit per test256 megabytes inpu

Problem--61A--Codeforces--A. Ultra-Fast Mathematician

A. Ultra-Fast Mathematician time limit per test2 seconds memory limit per test256 megabytes inputstandard input outp

Codeforces Round #436 (Div. 2), problem: (D) Make a Permutation!

scanf problem codeforce ++ round class span com make #include <cstdio> #include <cstring> #include <vector> using names

Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) Problem F (Codeforces 831F) - 數論 - 暴力

push_back pla ota round problem ont first push note Vladimir wants to modernize partitions in his office. To make the offic

Codeforces A - Bear and Prime 100(交互題)

mes 思路 logs cin out else 一個 如果能 pos A - Bear and Prime 100 思路:任何一個合數都可以寫成2個以上質數的乘積。在2-100中,除了4,9,25,49外都可以寫成兩個以上不同質數的乘積。 所以打一個質數加這四個數的表:{

Codeforces Round #439 (Div. 2) Problem C (Codeforces 869C) - 組合數學

note als 9.png fig fine 連接 time mod reac — This is not playing but duty as allies of justice, Nii-chan! — Not allies but j

A - HQ9+

DC have bits case nor ace als desc space Problem description HQ9+ is a joke programming language which has only four one-character instru

Codeforces A Mist of Florescence

++i 顏色 不可 ID dia 四種 app 英文 nta A Mist of Florescence 題目大意: 事先告訴你每種顏色分別有幾個聯通塊,構造一個不超過 \(50*50\) 的矩形。用 \(A,B,C,D\) 四種顏色來對矩形進行塗色使它滿足要求。 每種顏

「專題訓練」Hard problemCodeforces Round #367 Div. 2 C)

題意與分析 題意:給出\(n\)個字串,可以反轉任意串,反轉每個串都有其對應的花費\(c_i\)。經過操作後是否能滿足字串\(\forall i \in [1,n] \text{且} i \in R_+, str[i]\ge str[i-1]\),若能輸出最小花費,否則輸出-1。 分析:經過各種字串dp血虐

CGLIB Common causes of this problem include using a final class or a non-visible class;

類似以下的spring錯誤資訊: org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class $Proxy145]: Common causes o

@codeforces - <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="390e000a7e79">[email protected]a> Oleg and chess

目錄 @description - [email protected] @[email protected] @part - [email protected] @part - [email protected] @part -

@codeforces - <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4e7976780b0e">[email protected]a> ALT

目錄 @description - [email protected] @[email protected] @part - [email protected] @part - [email protected] @part -

D. Ehab and another another xor problemCodeforces Round #525 (Div. 2))(互動題)

傳送門 題意:這是個互動題,題意是這樣的,現在不知道a,b的值,但是有三種操作, 然後每次問完問題,也就是你輸出你的c和d,互動系統會給出相應的值(1/0/-1),然後你最多可以問62個問題,最後確定出這個a和b是多少?資料範圍: 題解:要想確定a和b的值,況且a,b的範圍最多是3

@codeforces - <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6650575e2126">[email protected]a> Combining Slimes

目錄 @[email protected] @[email protected] @part - [email protected] @part - [email protected] @part - [email p

@codeforces - <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b2848183f7f2">[email protected]a> Product Sum

目錄 @[email protected] @[email protected] @accepted [email protected] @[email protected] @[email protected] 給定一個序列

@codeforces - <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4b727d7b0c0b">[email protected]a> Bandit Blues

目錄 @[email protected] @[email protected] @part - [email protected] @part - [email protected] @accepted [email

Problem - 9D - Codeforces

nbsp strong 討論 分類討論 bst 規劃 img 轉移 怎麽 https://codeforces.com/problemset/problem/9/D 一開始居然還想直接找公式的,想了想還是放棄了。原來這種結構是要動態規劃。 狀態是知道怎麽設了,tnh表示節點

codeforces A. Domino piling

You are given a rectangular board of M × N squares. Also you are given an unlimited number of standard domino pieces of 2 × 1 squares. You are allowed t

Problem--41A--Codeforces--Translation

A. Translation time limit per test2 seconds memory limit per test256 megabytes inputstand