22477_BaudotDataCommunicationCode

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

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

Pro.ID

22477

Title

Baudot Data Communication Code

Title链接

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

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 1200/400 MS (Java/Others)     Memory Limit: 131072/65536 K (Java/Others)
  • 描述

    Data are communicated between digital computers as sequences of bits. To provide meaning to a sequence of bits, the bits are grouped to form a data character and an encoding scheme, or translation table, is provided to allow a computer system to translate each group of bits into a character. The ideal encoding scheme will provide a unique code for every possible character to be communicated and stored in the computer, but this requires that each group have a sufficient number of bits for each data character.

    A code used early in the data communications industry is the Baudot code. Baudot uses five bits per character, thus allowing up to 32 distinct characters. As a technique used to extend this limitation, the code uses up-shift and down-shift modes as is used on a typewriter. In the Baudot code, each five bits transmitted must be interpreted according to whether they are up-shifted (figures) or down-shifted (letters). For example, the bit pattern 11111 represents up-shift and the bit pattern 11011 represents dcwn-shift characters. All characters transmitted after the sequence 11111 but before the shifted sequence 11011 are treated as up-shift characters. All characters transmitted after the sequence 11011 are treated as down-shift characters until the pattern 11111 is recognized. The complete BAUDOT code (modified for this problem) is shown in the table at the end of this problem.

    输入

    The input consists of two parts. The first part is the Baudot character set: line one contains the 32 down-shift characters and line two contains the 32 up-shift characters. (Note: spaces are inserted for the shift characters.) The remainder of the input file consists of one or more messages encoded using the Baudot code. Each message will be on a line in the input file. Each line will consist of l's and 0's, with no characters between the bits. There can be up to 80 bits per message. The input file will be terminated by end-of-file. The initial state of each message should be assumed to be in the down-shift state.

    输出

    Description

    Data are communicated between digital computers as sequences of bits. To provide meaning to a sequence of bits, the bits are grouped to form a data character and an encoding scheme, or translation table, is provided to allow a computer system to translate each group of bits into a character. The ideal encoding scheme will provide a unique code for every possible character to be communicated and stored in the computer, but this requires that each group have a sufficient number of bits for each data character.

    A code used early in the data communications industry is the Baudot code. Baudot uses five bits per character, thus allowing up to 32 distinct characters. As a technique used to extend this limitation, the code uses up-shift and down-shift modes as is used on a typewriter. In the Baudot code, each five bits transmitted must be interpreted according to whether they are up-shifted (figures) or down-shifted (letters). For example, the bit pattern 11111 represents up-shift and the bit pattern 11011 represents dcwn-shift characters. All characters transmitted after the sequence 11111 but before the shifted sequence 11011 are treated as up-shift characters. All characters transmitted after the sequence 11011 are treated as down-shift characters until the pattern 11111 is recognized. The complete BAUDOT code (modified for this problem) is shown in the table at the end of this problem.

    Input
    The input consists of two parts. The first part is the Baudot character set: line one contains the 32 down-shift characters and line two contains the 32 up-shift characters. (Note: spaces are inserted for the shift characters.) The remainder of the input file consists of one or more messages encoded using the Baudot code. Each message will be on a line in the input file. Each line will consist of l's and 0's, with no characters between the bits. There can be up to 80 bits per message. The input file will be terminated by end-of-file. The initial state of each message should be assumed to be in the down-shift state.
    Output

    The output should consist of one line of text for each message. The output should contain the character representation, as translated using BAUDOT, of each of the messages.

    Sample Input
    <T*O HNM=LRGIPCVEZDBSYFXAWJ UQK
    >5@9 %,.+)4&80:;3"$?#6!/-2' 71(
    100100110011000010011111101110000111110111101
    001100001101111001001111100001001100010001100110111100000111
    Sample Output
    DIAL:911
    NOV 5, 8AM
    Hint
    Bit Pattern Down-Shift Character Up-Shift Character
    00000 < >
    00001 T 5
    00010 * @
    00011 O 9
    00100 Space Space
    00101 H %
    00110 N ,
    00111 M .
    01000 = +
    01001 L )
    01010 R 4
    01011 G &
    01100 I 8
    01101 P 0
    01110 C :
    01111 V ;
    10000 E 3
    10001 Z "
    10010 D $
    10011 B ?
    10100 S #
    10101 Y 6
    10110 F !
    10111 X /
    11000 A -
    11001 W 2
    11010 J '
    11011 Shift Down Shift Down
    11100 U 7
    11101 Q 1
    11110 K (
    11111 Shift Up Shift Up
    Source

    样例输入

    <T*O HNM=LRGIPCVEZDBSYFXAWJ UQK
    >5@9 %,.+)4&80:;3"$?#6!/-2' 71(
    100100110011000010011111101110000111110111101
    001100001101111001001111100001001100010001100110111100000111

    样例输出

    DIAL:911
    NOV 5, 8AM

    提示

    Bit Pattern Down-Shift Character Up-Shift Character
    00000 < >
    00001 T 5
    00010 * @
    00011 O 9
    00100 Space Space
    00101 H %
    00110 N ,
    00111 M .
    01000 = +
    01001 L )
    01010 R 4
    01011 G &
    01100 I 8
    01101 P 0
    01110 C :
    01111 V ;
    10000 E 3
    10001 Z "
    10010 D $
    10011 B ?
    10100 S #
    10101 Y 6
    10110 F !
    10111 X /
    11000 A -
    11001 W 2
    11010 J '
    11011 Shift Down Shift Down
    11100 U 7
    11101 Q 1
    11110 K (
    11111 Shift Up Shift Up


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部