22123_Encryption

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

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

Pro.ID

22123

Title

Encryption

Title链接

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

AC

0

Submit

0

Ratio

-

时间&空间限制

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

    Let me introduce an easy method of encryption to you.

    Suppose there’re N bytes (1 byte = 8 bits) data that are to be encrypted and we want to encrypt them in groups of M bytes, while for the last group we may need to add some zeros to make up M bytes. Then we find out an M*M matrix (Aij) m*m. Now for each group, suppose M bytes are X1, X2, ..., Xm, and we will generate the encrypted data Y1, Y2, ..., Ym from the following equations:

    Yi = (X1*Ai1) + (X2*Ai2) + ... + (Xm*Aim)

    i = l, 2, 3, ..., m

    输入

    There are multiple cases.

    For each case, there are two numbers N and M ( 1 <= N <= 100, 2 <= M <= 10 ) in the first line. In the second line are N numbers to be encrypted (between 0 and 255). While in the following if lines, each line contains M numbers and the j-th number in the i-th line of these M lines is Aij (0 <= Aij <= 255). Numbers in the same line are separated by spaces.

    Input will be ended by end of file.

    输出

    Description

    Let me introduce an easy method of encryption to you.

    Suppose there’re N bytes (1 byte = 8 bits) data that are to be encrypted and we want to encrypt them in groups of M bytes, while for the last group we may need to add some zeros to make up M bytes. Then we find out an M*M matrix (Aij) m*m. Now for each group, suppose M bytes are X1, X2, ..., Xm, and we will generate the encrypted data Y1, Y2, ..., Ym from the following equations:

    Yi = (X1*Ai1) + (X2*Ai2) + ... + (Xm*Aim)

    i = l, 2, 3, ..., m

    Input

    There are multiple cases.

    For each case, there are two numbers N and M ( 1 <= N <= 100, 2 <= M <= 10 ) in the first line. In the second line are N numbers to be encrypted (between 0 and 255). While in the following if lines, each line contains M numbers and the j-th number in the i-th line of these M lines is Aij (0 <= Aij <= 255). Numbers in the same line are separated by spaces.

    Input will be ended by end of file.

    Output
    For each case, output one line of the encrypted data. If the encrypted data contains K numbers, use AM spaces to separate them.
    Sample Input
    4 2
    1 2 3 4
    0 1
    1 0
    1 2
    1
    3 1
    0 1
    10 10
    100 100 100 100 100 100 100 100 100 100
    100 100 100 100 100 100 100 100 100 100
    0 1 0 0 0 0 0 0 0 0
    0 0 1 0 0 0 0 0 0 0
    0 0 0 1 0 0 0 0 0 0
    0 0 0 0 1 0 0 0 0 0
    0 0 0 0 0 1 0 0 0 0
    0 0 0 0 0 0 1 0 0 0
    0 0 0 0 0 0 0 1 0 0
    0 0 0 0 0 0 0 0 1 0
    0 0 0 0 0 0 0 0 0 1
    Sample Output
    2 1 4 3
    3 0
    100000 100 100 100 100 100 100 100 100 100
    Source

    样例输入

    4 2
    1 2 3 4
    0 1
    1 0
    1 2
    1
    3 1
    0 1
    10 10
    100 100 100 100 100 100 100 100 100 100
    100 100 100 100 100 100 100 100 100 100
    0 1 0 0 0 0 0 0 0 0
    0 0 1 0 0 0 0 0 0 0
    0 0 0 1 0 0 0 0 0 0
    0 0 0 0 1 0 0 0 0 0
    0 0 0 0 0 1 0 0 0 0
    0 0 0 0 0 0 1 0 0 0
    0 0 0 0 0 0 0 1 0 0
    0 0 0 0 0 0 0 0 1 0
    0 0 0 0 0 0 0 0 0 1

    样例输出

    2 1 4 3
    3 0
    100000 100 100 100 100 100 100 100 100 100

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部