21741_Givenastring

2022-5-16 18:20| 发布者: Hocassian| 查看: 28| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-4-89505808623199-Problem List-采集的数据-后羿采集器.html

Pro.ID

21741

Title

Given a string. . .

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=21741

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    Peter’s colleague Andrew also works at RIGS. Some time ago Andrew invented another definition of sum of two strings of equal length n. In Andrew’s definition, the basic alphabet to define this operation consists only of zeros and ones. The sum of two strings a + b is just a string c where ci = ai V bi (Si denotes i-th character of string S). Here V stands for usual OR operation which returns 1 if and only if at least one of its arguments is 1.
    Now Peter must study properties of closure of a given string S. The closure of S (denoted ) is a set of strings S(k) + S(l) for any 0 ≤ k, l n-1, where n is the length of S, and S(k) denotes an operationof 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 . 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 100 characters. All characters in these strings are zeros or ones.

    输出

    Description
    Peter’s colleague Andrew also works at RIGS. Some time ago Andrew invented another definition of sum of two strings of equal length n. In Andrew’s definition, the basic alphabet to define this operation consists only of zeros and ones. The sum of two strings a + b is just a string c where ci = ai V bi (Si denotes i-th character of string S). Here V stands for usual OR operation which returns 1 if and only if at least one of its arguments is 1.
    Now Peter must study properties of closure of a given string S. The closure of S (denoted ) is a set of strings S(k) + S(l) for any 0 ≤ k, l n-1, where n is the length of S, and S(k) denotes an operationof 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 . Could you solve this task for him?
    Input
    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 100 characters. All characters in these strings are zeros or ones.
    Output

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

    Sample Input
    Sample #1
    11110
    10101
    Sample #2
    101111
    101010
    Sample Output
    Sample #1
    Yes
    Sample #2
    No
    Source

    样例输入

    Sample #1
    11110
    10101
    Sample #2
    101111
    101010

    样例输出

    Sample #1
    Yes
    Sample #2
    No

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部