ZOJ3775 ?(>_o)! 2017-04-13 23:37 110人阅读 评论(0) 收藏
?(>_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) 收藏的更多相关文章
- 并查集 基础 AC 2014-01-14 13:37 202人阅读 评论(0) 收藏
题目地址:http://haut.openjudge.cn/20131112/6/ 求编号最多的组 查看 提交 统计 提问 总时间限制: 1000ms 内存限制: 63353kB 描述 相邻两个 ...
- 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 ...
- HDU 2040 亲和数 [补] 分类: ACM 2015-06-25 23:10 10人阅读 评论(0) 收藏
今天和昨天都没有做题,昨天是因为复习太累后面忘了,今天也是上午考毛概,下午又忙着复习计算机图形学,晚上也是忘了结果打了暗黑3,把暗黑3 打通关了,以后都不会玩太多游戏了,争取明天做3题把题目补上,拖越 ...
- iOS中UITextField 使用全面解析 分类: ios技术 2015-04-10 14:37 153人阅读 评论(0) 收藏
//初始化textfield并设置位置及大小 UITextField *text = [[UITextField alloc]initWithFrame:CGRectMake(20, 20, 13 ...
- 记一个神奇的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 ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
随机推荐
- Window平台下React Native 开发环境搭建
1. 安装Node.js 2. 安装react-native-cli 命令行工具 npm install -g react-nativew-cli 3. 创建项目 $ react-native ini ...
- 堆排序算法-python实现
#-*- coding: UTF-8 -*- import numpy as np def MakeHeap(a): for i in xrange(a.size / 2 - 1, -1, -1):# ...
- 单线程和多线程处理1W条数据对比代码
package study.interview; import java.util.ArrayList; import java.util.HashMap; import java.util.Link ...
- 6.1课堂笔记—DML(数据操作语言),DQL查询语句
一.DML(数据操作语言) InnoDB MyISAM 支持事务 不支持事务 不支持全文索引 支持全文索引 支持外键约束 不支持 命令查看默认存储引擎 show variables like '%st ...
- React性能优化 PureComponent
为什么使用? React15.3中新加了一个 PureComponent 类,顾名思义, pure 是纯的意思, PureComponent 也就是纯组件,取代其前身 PureRenderMixin ...
- C++ - 常用的标准库函数
写在前面 C++是一门博大精深的语言,也是最难学的一门编程语言,每一位励志学好C++的程序员都需要从基本功开始,稳扎稳打. 自从1998年C++ standard定案以后,C++程序库便有了大幅扩 ...
- linux下创建具有root权限的账户
http://blog.chinaunix.net/uid-24631445-id-2981034.html
- asp.net要验证的用户名和密码
FormsAuthentication.Authenticate()方法要验证的用户名和密码必须存储在Web.config文件内.如果要验证存储在“ASP.NET成员资格数据库”中的密码,则需要调用M ...
- open()打开文件失败对应的各种错误码
open()打开文件失败错误码: 获取错误信息实例: HANDLE hFile = ; hFile = open(“c:\test.txt”, O_RDWR, S_IRWXU|S_IRWXG|S_IR ...
- blocking network call
[blocking network call] 阻塞的网络调用: 1.gethostbyname(): does not return until it has succeeded or failed ...