?(>_o)!


Time Limit: 2 Seconds      Memory Limit: 65536 KB


?(>_o)! is a pseudo-object-oriented programming language. It implements the following commands:

Command Description
? 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.
o Instantiate 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 characters Be 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.

Input

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

Output

For each test case, output "Yes" if it is a quine. Otherwise, output "No".

Sample Input

4
Hello, world!
source_code
source__code
?(>_o)!

Sample Output

Yes
Yes
No
No

Hint

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;
}

ZOJ3775 ?(>_o)! 2017-04-13 23:37 110人阅读 评论(0) 收藏的更多相关文章

  1. 并查集 基础 AC 2014-01-14 13:37 202人阅读 评论(0) 收藏

    题目地址:http://haut.openjudge.cn/20131112/6/ 求编号最多的组 查看 提交 统计 提问 总时间限制:  1000ms  内存限制:  63353kB 描述 相邻两个 ...

  2. NYOJ-235 zb的生日 AC 分类: NYOJ 2013-12-30 23:10 183人阅读 评论(0) 收藏

    DFS算法: #include<stdio.h> #include<math.h> void find(int k,int w); int num[23]={0}; int m ...

  3. HDU 2040 亲和数 [补] 分类: ACM 2015-06-25 23:10 10人阅读 评论(0) 收藏

    今天和昨天都没有做题,昨天是因为复习太累后面忘了,今天也是上午考毛概,下午又忙着复习计算机图形学,晚上也是忘了结果打了暗黑3,把暗黑3 打通关了,以后都不会玩太多游戏了,争取明天做3题把题目补上,拖越 ...

  4. iOS中UITextField 使用全面解析 分类: ios技术 2015-04-10 14:37 153人阅读 评论(0) 收藏

    //初始化textfield并设置位置及大小   UITextField *text = [[UITextField alloc]initWithFrame:CGRectMake(20, 20, 13 ...

  5. 记一个神奇的WAS问题:sibuswsgw-sibuswsgw_console.jar invalid LOC header (bad signature) 分类: WebSphere 2015-08-06 23:21 9人阅读 评论(0) 收藏

    今天晚上,出现了一个神奇的WAS问题,详细问题异常信息如下: [15-8-6 22:13:29:146 CST] 00000013 ApplicationMg A WSVR0203I: 应用程序:is ...

  6. Hdu 1009 FatMouse' Trade 2016-05-05 23:02 86人阅读 评论(0) 收藏

    FatMouse' Trade Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Tot ...

  7. ZOJ2482 IP Address 2017-04-18 23:11 44人阅读 评论(0) 收藏

    IP Address Time Limit: 2 Seconds      Memory Limit: 65536 KB Suppose you are reading byte streams fr ...

  8. PAT甲 1029. Median (25) 2016-09-09 23:11 27人阅读 评论(0) 收藏

    1029. Median (25) 时间限制 1000 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Given an incr ...

  9. PAT甲 1011. World Cup Betting (20) 2016-09-09 23:06 18人阅读 评论(0) 收藏

    1011. World Cup Betting (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Wit ...

随机推荐

  1. Tomcat 性能优化(连接数、线程、JVM、dir)

    Tomcat的server.xml中Context元素的以下参数应该怎么配合适 <Connector port="8080" maxThreads="150&quo ...

  2. C# 实现快速闪电关机、快速重启

    using System; using System.Runtime.InteropServices; namespace FastReboot { static class Program { pr ...

  3. 异步FIFO中空满信号如何产生?

    异步FIFO中,空满信号该如何产生呢? 在复位的时候,读指针和写指针相等,读空信号有效(这里所说的指针其实就是读地址.写地址)当读指针赶上写指针的时候,写指针等于读指针意味着最后一个数据被读完,此时读 ...

  4. 在Visual Studio调试器中显示Unreal的数据类型的值

    转自:https://blog.csdn.net/witton/article/details/5977766 在Unreal引擎中大量使用了自定义的数据类型如:FName,FString,TArra ...

  5. bom知识点

    1.BOM输出 所谓BOM指的是浏览器对象模型 Browser Object Model,它的核心就是浏览器 alert(1);//弹出框 调式使用 console.log('路飞学城');//用于浏 ...

  6. 30_java之DButils工具类

    01DButils工具类的介绍个三个核心类 * A: DButils工具类的介绍个三个核心类 * a: 概述 * DBUtils是java编程中的数据库操作实用工具,小巧简单实用. * DBUtils ...

  7. Python实践练习:选择性拷贝

    题目 项目要求:编写一个程序,遍历一个目录树,查找特定扩展名的文件(诸如.pdf 或.jpg),不论这些文件的位置在哪里, 将它们拷贝到一个新的文件夹中. 代码 import os import sh ...

  8. BeanUtils.copyProperties不能copy复杂对象List的解决方式

    需要注意的就是把List拆分,遍历add,然后把list设置到返回对象中 package test.test; import java.util.ArrayList; import java.util ...

  9. 迷你MVVM框架 avalonjs 学习教程4、数据填充

    MVVM是前端的究极解决方案,你们可能用过jQuery,但那个写的代码不易维护:你们可以听过说requirejs与seajs,传说中的模块开发,加载器,但它们的最终目标是打包:你们可能听过unders ...

  10. Redis 发布/定阅

    [Redis 发布/定阅] 1.SUBSCRIBE channel [channel ...] 订阅给定的一个或多个频道的信息. 2.PSUBSCRIBE pattern [pattern ...] ...