当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3541:Given a string…

题目描述

Peter’s Boss is now very upset. He said that Peter’s vision of the orthogonal sum of two strings is not collinear to the general pary line of RIGS. At least, it is very bad that the orthogonal sum of two strings in Peter’s vision can be different depending on a selected set of strings. But Boss decided to give Peter a last str…well, a chance.

Peter’s colleague Andrew invented another definition of orthogonal sum of two strings of equal length n, which depends only on the alphabet. The basic alphabet to define this operation consists only of zeros and ones. The orthogonal sum of two strings ab is just a string c where ci = aibi (Si denotes i-th character of string S). Here ⊕ stands for exclusive OR operation which returns 0 for equal characters and 1 otherwise.

Now Peter must study properties of orthogonal closure of a given string S. The orthogonal closure of S (denoted S) is a set of strings S(k)S(l) for any 0 ≤ k, ln − 1, where n is the length of S, and S(k) denotes an operation of k-th circular shift of S — moving k last characters from the end of the string S to its beginning. For example, the second circular shift of abcde is deabc.

Given a string T, Peter’s task is to check whether it belongs to S. Could you solve this task for him?

输入解释

The first line of the input file contains a given string T. The second line contains S. Both strings are of equal length in range from 1 to 5 000 characters. All characters in these strings are zeros or ones.

输出解释

If a given string belongs to S, output “Yes”. Otherwise output “No”.

输入样例
#111111
10101
#211110
10101
输出样例
#1No
#2Yes
来自北京大学POJ的附加信息
Case time limit(单组数据时间限制) 2000MS

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-3541

最后修改于 2020-10-29T07:04:02+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
10000 65536