?(>_o)! is a pseudo-object-oriented programming language. It implements the following commands:
CommandDescription?Check whether the character '?' is in the program's source code. If '?' does not exist in the program's source, the hardware will catch fire or explode.(It tries to match ')', although mismatch of brackets does not matter at all.>Increase the internal accumulator._Print the program's source code.oInstantiate an object of a new sub class of the generic super class. Due to the best principles of object hiding, this object cannot be accessed in any way.)Just matches '('. It's for patient with obsessive-compulsive disorder. However, mismatch of brackets does not matter at all.!Print "Hello, world!".Other charactersBe treated as comments rather than instruction.However, it's only another joke programming language. There is even no way to access the accumulator. But it's one of easiest to finish a "Hello world" program or a quine program. A quine is a computer program which takes no input and produces a copy of its own source code as its only output. Your task is to judge whether a ?(>_o)! program is a quine.
There are multiple test cases. The first line of input is an integer T indicates the number of test cases. For each test case:
There is one line of string represents the source code of a ?(>_o)! program. The program contains no more than 256 characters. The ASCII value of each character is within [32, 126].
For each test case, output "Yes" if it is a quine. Otherwise, output "No".
The output of the four sample programs are {"Hello, world!", "source_code", "source__codesource__code", "?(>_o)!Hello, world!"} respectively. Therefore the first two programs are quines, and the last two are not.
Luckily, there is a '?' in the fourth program, so the hardware will not catch fire or explode during running the fourth program.
—————————————————————————————————————
题目的意思又臭又长,其实没什么就是给出一个字符串,!表示输出Hello, world!,_表示把原字符串输出一遍,判断输出的字符串和原字符串是否一样
#include <iostream> #include<queue> #include<cstdio> #include<algorithm> #include<cmath> #include<set> #include <cstring> using namespace std; #define LL long long int main() { int T; char s[100004]; char ss[100004]; char sh[]="Hello, world!"; scanf("%d",&T); getchar(); while(T--) { int cnt=0; gets(s); memset(ss,0,sizeof(ss)); int k=strlen(s); for(int i=0;i<k;i++) { if(s[i]=='_') strcat(ss,s); if(s[i]=='!') strcat(ss,sh); } if(strcmp(ss,s)!=0) printf("No\n"); else printf("Yes\n"); } return 0; }