yqdnp/p> 俊秀的菠萝p align="left">dsdhlb is a joke p" /> yqdnp/p> 俊秀的菠萝p align="left">dsdhlb is a joke p" />
首页 > 编程知识 正文

Codeforces Beta Round #96 (Div. 2) 133A. HQ9+

时间:2023-05-03 08:10:07 阅读:249574 作者:1510

俊秀的菠萝p align="center">yqdnp/p> 俊秀的菠萝p align="left">dsdhlb is a joke programming language which has only four one-character instructions:俊秀的菠萝/p> ·  "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. 俊秀的菠萝p align="left">Instructions "H" and "Q" are case-sensitive and must be uppercase. The characters of the program which are not instructions are ignored.俊秀的菠萝/p> 俊秀的菠萝p align="left">You are given a program written in dsdhlb. You have to figure out whether executing this program will produce any output.俊秀的菠萝/p> 俊秀的菠萝p align="left">俊秀的菠萝strong>Input俊秀的菠萝/strong>俊秀的菠萝/p> 俊秀的菠萝p align="left">The input will consist of a single line p which will give a program in dsdhlb. 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.俊秀的菠萝/p> 俊秀的菠萝p align="left">俊秀的菠萝strong>Output俊秀的菠萝/strong>俊秀的菠萝/p> 俊秀的菠萝p align="left">Output "YES", if executing the program will produce any output, and "NO" otherwise.俊秀的菠萝/p> 俊秀的菠萝p align="left">俊秀的菠萝strong>Sample test(s)俊秀的菠萝/strong>俊秀的菠萝/p> 俊秀的菠萝p align="left">俊秀的菠萝strong>Input俊秀的菠萝/strong>俊秀的菠萝/p> 俊秀的菠萝p align="left">Hi!俊秀的菠萝/p> 俊秀的菠萝p align="left">俊秀的菠萝strong>Output俊秀的菠萝/strong>俊秀的菠萝/p> 俊秀的菠萝p align="left">YES俊秀的菠萝/p> 俊秀的菠萝p align="left">俊秀的菠萝strong>Input俊秀的菠萝/strong>俊秀的菠萝/p> 俊秀的菠萝p align="left">Codeforces俊秀的菠萝/p> 俊秀的菠萝p align="left">俊秀的菠萝strong>Output俊秀的菠萝/strong>俊秀的菠萝/p> 俊秀的菠萝p align="left">NO俊秀的菠萝/p> 俊秀的菠萝p align="left">俊秀的菠萝strong>Note俊秀的菠萝/strong>俊秀的菠萝/p> 俊秀的菠萝p align="left">In the first case the program contains only one instruction — "H", which prints "Hello, World!".俊秀的菠萝/p> 俊秀的菠萝p align="left">In the second case none of the program characters are language instructions.俊秀的菠萝/p> 俊秀的菠萝p>解题报告:就是判断一个字符串中是否含有Q、H、9.如果含有则输出YES!,唉!英语太差!第一次理解错了!俊秀的菠萝/p> #include <iostream>俊秀的菠萝br>#include <cstdio>俊秀的菠萝br>#include <cstring>俊秀的菠萝br>#include <cstdlib>俊秀的菠萝br>using namespace std;俊秀的菠萝br>const int N =110;俊秀的菠萝br>char str[N];俊秀的菠萝br>int main()俊秀的菠萝br>{俊秀的菠萝br>int len,i,flag;俊秀的菠萝br> scanf("%s",str);俊秀的菠萝br> len=strlen(str);俊秀的菠萝br> flag=0;俊秀的菠萝br>for(i=0;i<len;i++)俊秀的菠萝br> {俊秀的菠萝br>if(str[i]=='Q'||str[i]=='H'||str[i]=='9')俊秀的菠萝br> {俊秀的菠萝br> flag=1;俊秀的菠萝br>break;俊秀的菠萝br> }俊秀的菠萝br> }俊秀的菠萝br>if(flag)俊秀的菠萝br> {俊秀的菠萝br> printf("YESn");俊秀的菠萝br> }俊秀的菠萝br>else俊秀的菠萝br> {俊秀的菠萝br> printf("NOn");俊秀的菠萝br> }俊秀的菠萝br>return 0;俊秀的菠萝br>} 俊秀的菠萝p> 俊秀的菠萝/p> 俊秀的菠萝p直率的大叔载于:https://www.cnblogs.com/lidaojian/archive/2011/12/05/2277371.html俊秀的菠萝/p>

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。