ZOJ 3775 ?(>_o)!
来源:互联网 发布:vs2015怎么用c语言 编辑:程序博客网 时间:2024/05/18 17:58
?(>_o)! is a pseudo-object-oriented programming language. It implements the following commands:
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
4Hello, world!source_codesource__code?(>_o)!
Sample Output
YesYesNoNo
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.
题目的意思是给定一些指令的功能:
第一行给出样例数T
接下来每行给一个源代码
若该代码执行后的结果跟源代码完全相同,则输出"Yes”,否则输出“No”.
其实除了“!”和“_”以外的其他指令都并不会影响程序.
#include <iostream>#include<string>#include<cstdio>#include<cstring>using namespace std;int g[5]={0,1,3,6,10};int main(){ int t; cin>>t; getchar(); while(t--) { string s1,s2; getline(cin,s1); int flag=0; for(int i=0;i<s1.length();i++) { if(s1[i]=='_') s2=s2+s1; else if(s1[i]=='!') s2+="Hello, world!"; } if(s1==s2) cout<<"Yes"<<endl; else cout<<"No"<<endl; } return 0;}
- zoj 3775 ?(>_o)!
- ZOJ 3775 ?(>_o)!(模拟)
- ZOJ 3775 ?(>_o)!
- ZOJ 3775 ?(>_o)!
- ?(>_o)!
- 第14届浙江大学程序设计竞赛 I. ?(>_o)! (ZOJ 3775)
- ZOJ3775:?(>_o)!
- ZOJ3775 ?(>_o)!
- ZOJ3775 ?(>_o)!
- ZOJ3775-?(>_o)!
- 字符串水题 N - ?(>_o)!
- zoj 3775
- ZOJ-3775
- zoj 3775
- Java web 服务_O'REILLY_个人读书笔记
- 算法学习 - 链表之归并排序_O(1)空间_O(NlogN)时间_C++
- ZOJ
- ZOJ
- Linux第十单元练习题
- 阿里云ECS CentOS lamp搭建及绑定多个网站
- linux进程调度浅析
- poj 1182
- 错过,不代表失败
- ZOJ 3775 ?(>_o)!
- jsp界面写入数据库时中文乱码(sql语句执行中文乱码)解决办法
- php验证码之汉字验证
- 详细了解 int? 类型
- 第七周作业1(LeetCode9)
- 输入一个10000以内的浮点数,然后将该浮点数转化成像读取人民币一样的字符串,打印出来
- 欢迎使用CSDN-markdown编辑器
- 汇编写启动代码413
- 凯撒密码,简单的加密