10179_Cryptcowgraphy

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

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

Pro.ID

10179

Title

Cryptcowgraphy

Title链接

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

AC

3

Submit

14

Ratio

21.43%

时间&空间限制

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

    The cows of Farmer Brown and Farmer John are planning a coordinated escape from their respective farms and have devised a method of encryption to protect their written communications.

    Specifically, if one cow has a message, say, "International Olympiad in Informatics", it is altered by inserting the letters C, O, and W, in random location in the message, such that C appears before O, which appears before W. Then the cows take the part of the message between C and O, and the part between O and W, and swap them. Here are two examples:

       International Olympiad in Informatics   ->    CnOIWternational Olympiad in Informatics

       International Olympiad in Informatics    ->    International Cin InformaticsOOlympiad W

    To make matters more difficult, the cows can apply their encryption scheme several times, by again encrypting the string that results from the previous encryption. One night, Farmer John's cows receive such a multiply-encrypted message. Write a program to compute whether or not the non-encrypted original message could have been the string:

    Begin the Escape execution at the Break of Dawn

    输入

    Multiple test cases. For each case is a single line (with both upper and lower case) with no more than 75 characters that represents the encrypted message.

    输出

    Description

    The cows of Farmer Brown and Farmer John are planning a coordinated escape from their respective farms and have devised a method of encryption to protect their written communications.

    Specifically, if one cow has a message, say, "International Olympiad in Informatics", it is altered by inserting the letters C, O, and W, in random location in the message, such that C appears before O, which appears before W. Then the cows take the part of the message between C and O, and the part between O and W, and swap them. Here are two examples:

       International Olympiad in Informatics   ->    CnOIWternational Olympiad in Informatics

       International Olympiad in Informatics    ->    International Cin InformaticsOOlympiad W

    To make matters more difficult, the cows can apply their encryption scheme several times, by again encrypting the string that results from the previous encryption. One night, Farmer John's cows receive such a multiply-encrypted message. Write a program to compute whether or not the non-encrypted original message could have been the string:

    Begin the Escape execution at the Break of Dawn

    Input

    Multiple test cases. For each case is a single line (with both upper and lower case) with no more than 75 characters that represents the encrypted message.

    Output

    For each case, output two integers on a single line. The first integer is 1 if the message decodes as an escape message; 0 otherwise. The second integer specifies the number of encryptions that were applied (or 0 if the first integer was 0).

    Sample Input

    Begin the EscCution at the BreOape execWak of Dawn

    Sample Output

    1 1

    Source

    样例输入

    Begin the EscCution at the BreOape execWak of Dawn

    样例输出

    1 1

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部