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 ...
随机推荐
- 【python】 Windows下pip安装包报错:Microsoft Visual C++ 9.0 is required Unable to find vcvarsall.bat
刚在机器上windows环境下装上pip方便以后安装包的时候使用,谁知道第一次使用pip安装asyncio的时候就报错. 在Windows7x64下使用pip安装包的时候提示报错:Microsoft ...
- vagrant 相关记录
最近安装vagrant 出错的最大的可能性是BOX 路径不太对, 好像和目录的大小写有关系,请检查 $ vagrant init # 初始化$ vagrant up # 启动虚拟机$ vagrant ...
- ffmpeg+nginx+video实现rtsp流转hls流,通过H5查看监控视频
一.FFmpeg下载:http://ffmpeg.zeranoe.com/builds/ 下载并解压FFmpeg文件夹,配置环境变量:在“Path”变量原有变量值内容上加上d:\ffmpeg\bin, ...
- charles手机抓包配置-2
破解的安装包,自己的百度云里有收藏 http://www.zhimengzhe.com/IOSkaifa/248398.html http://blog.csdn.net/swj6125/articl ...
- Express详解
express() 创建一个express应用程序 var express = require('express'); var app = express(); app.get('/', functi ...
- JavaScript(三) - 精简
javascript 对象 1 什么是对象? 对象只是一种特殊的数据,对象拥有属性和方法. 2 对象有哪些? js中所有的事物都是对象:字符串,数值,数组,函数. js允许自定义对象.提供多个内建对象 ...
- 常见的JS和CSS问题
事件冒泡 DOM的事件冒泡机制和WPF很相似,DOM事件机制包含冒泡和捕获两种,按照topmost element->innermost element方向传递事件被称为捕获方式,而从inner ...
- fiddler工具条、状态栏、请求信息栏各按钮的作用
1.fiddler工具条 2.fiddler状态栏 3.请求信息栏
- kafka启动报java.net.UnknownHostException
kafka启动报java.net.UnknownHostException 参考资料: 1.https://blog.csdn.net/zdxiq000/article/details/6258765 ...
- SpringMVC 执行流程