?(>_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. 设置vim颜色方案

    获取所有vim颜色配置方案 ls /usr/share/vim/vim74/colors/ [root@lx ~]# ls /usr/share/vim/vim74/colors/ blue.vim ...

  2. linux中查看nginx、apache、php、mysql配置文件路径的方法

    如何在Linux中查看nginx.apache.PHP.MySQL配置文件路径了,如果你接收一个别人配置过的环境,但没留下相关文档.这时该怎么判断找到正确的加载文件路径了.可以通过以下来判断1.判断a ...

  3. 爬取爱奇艺电视剧url

    ----因为需要顺序,所有就用串行了---- import requests from requests.exceptions import RequestException import re im ...

  4. linux Posix 信号量 一

    信号量是一种用于提供不同进程间或一个给定进程的不同线程间同步手段的原语. linux提供两种信号量,“内核信号量”和“用户态进程信号量”,“用户态信号量”又分为“Posix”,“System V”信号 ...

  5. PackedSyncPtr

    folly/PackedSyncPtr.h A highly specialized data structure consisting of a pointer, a 1-bit spin lock ...

  6. Android BroadcastReceiver 的简单实现

    参考:http://yangguangfu.iteye.com/blog/1063732 BroadcastReceiver的实现不难,其实就是三部曲:注册,接收,发送. 但有一点较疑惑的是:当我启动 ...

  7. red ant

    Red Ant(红蚁)网络运维管理系统是IT运维管理系统,提供智能的B/S接口可视化人机界面,通过简单的操作实现全方位的网络专线.服务器.中间件.各种应 用程序.机房动力环境等监控管理,“化繁为简”, ...

  8. signal模块简介

    signal模块简介 最近在看Linux signal 相关内容,signal可以被用来进程间通信和异步处理.Python标准库提供了signal包可以用来处理信号相关.这里讨论的是Unix系统中Py ...

  9. 实用 Linux 命令行使用技巧集锦

    最近在Quora上看到一个问答题目,关于在高效率Linux用户节省时间Tips.将该题目的回答进行学习总结,加上自己的一些经验,记录如下,方便自己和大家参考. 下面介绍的都是一些命令行工具,这些工具在 ...

  10. clientX,offsetX,screenX,pageX 区别!

    先总结下区别: event.clientX.event.clientY 鼠标相对于浏览器窗口可视区域的X,Y坐标(窗口坐标),可视区域不包括工具栏和滚动条.IE事件和标准事件都定义了这2个属性 eve ...