ZOJ3775-?(>_o)!
来源:互联网 发布:江南七怪 知乎 编辑:程序博客网 时间:2024/06/04 19:46
?(>_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.
Author: ZHOU, Yuchen
Source: The 14th Zhejiang University Programming Contest
题意:有一个下划线表示把输入输出一次,感叹号表示输出"Hello, world!"
#include <iostream>#include <cstdio>#include <cstring>#include <string>#include <algorithm>#include <cmath>#include <map>#include <set>#include <stack>#include <queue>#include <vector>#include <bitset>using namespace std;int main(){ int n; cin>>n; getchar(); while(n--) { string s; getline(cin,s); string output=""; auto it=begin(s); for(;it!=end(s);it++) { if(*it=='_')output+=s; else if(*it=='!')output+="Hello, world!"; } printf("%s",!s.compare(output)?"Yes\n":"No\n"); } return 0;}
- ZOJ3775:?(>_o)!
- ZOJ3775 ?(>_o)!
- ZOJ3775 ?(>_o)!
- ZOJ3775-?(>_o)!
- zoj3775
- ?(>_o)!
- zoj 3775 ?(>_o)!
- ZOJ 3775 ?(>_o)!(模拟)
- ZOJ 3775 ?(>_o)!
- ZOJ 3775 ?(>_o)!
- 字符串水题 N - ?(>_o)!
- Java web 服务_O'REILLY_个人读书笔记
- 算法学习 - 链表之归并排序_O(1)空间_O(NlogN)时间_C++
- 黑马程序员_O‘Reilly java nio学习笔记之选择器
- 算法系列_基础01_O(nlogn)的理解
- _I ,_O ,_IO,__IO的定义与用法
- 黑马程序员_O‘Reilly java nio学习笔记之缓冲区1
- 黑马程序员_O‘Reilly java nio学习笔记之缓冲区2
- Mybatis 聚合函数
- float和double丢失精度问题,可用Long来转换
- 封装jquery插件很简单
- SuperMap iServer Java 如何配置缓存参数
- Follow me 挑战程序与设计
- ZOJ3775-?(>_o)!
- 单链表的基本操作
- ACM n-1位数
- Java 保留2位小数点(2种方式)
- atomikos 在Windows Tomcat下使用遇到的坑
- wireshark权限不够
- 项目开发笔记
- javascript放在head和body的区别(w3c建议放在head标签中)
- 一个小demo