2686Convolution Codes

2686   Convolution Codes

题目描述

Channel is a very important part of a digital communication systemThe characteristics of the channel affect the performance of the whole digital communication systemThe noise and interference in the real channel make the codes received different from the codes sentThe difference is generally called errorIn order to improve the quality of communication and ensure the reliability and validity of communication, error-control coding is usually adopted to correct the errors produced in the process of transfer before the digital signals enter the channel

Error-control coding is all effective method to enhance the communication quality by adding redundant information into the original message. Convolution code is a kind of error-correcting code which is used very widely. Soas the corresponding best decode method of the convolution codesViterbi decoder is always researched widely

Now, we only want to do some research about the encoding of convolution codes. First we give an example to you to explain the procedure of the encoding:

If we research the encoding of the 217 convolution codes. And the rate of the convolution codes is 1/2, the construction is the following picture:

The connection parameter is 1011011 and 1111001. So we can define the generation matrix P:


So:

P(1)=[1 0 1 1 0 1 1]

P(2)=[1 1 1 1 0 0 1]

As we all know, the convolution operation( ' ' ) is defined as follows:

For the discrete convolution,

We can know : 

length(Z) = length(X))+ length(Y) – 1;

In this problem we use the binary discrete convolution. When we calculate ,We should also do it like this :

First, do the discrete convolution, then for all the Z(i), Z(i) = Z(i) % 2;

If we give an input A=[1 1 1 0 1 1 1 0 1 1], we need to calculate the output sequence after encoding. As above, the generation matrix has told to you, so We can calculate the answer as follows:

B = AP(1);       C = AP(2);

Then for every B(i) and C(i), you just need do like this

B(i) = B(i) % 2=[1100110001100101];      C(i) = C(i) % 2=[1011110001110011];

The encoding output is [B(1)C(1)B(2)C(2) ……];

In this problem, the generation matrix is unique which is told above, we will give you the input sequence, you will tell us the sequence after encoding.  Pay attention to that all the input and output is 0 or 1 sequence. 

输入格式:

There are plenty of test casesfor each test case There is a sequence which contains a series of ‘0’ and ‘1’ in one line. The length of the input sequence is at most 1000 and at least 1.  The end of the input is indicated by the end of the file(EOF).

输出格式:

For each test case , you should output the test case number and the sequence after convolution encoding in a line. The format is like the sample.

输入样例 复制
1110111011
0100111
111011000
1111
01100
110101
输出样例 复制
Case 1: 11100101111100000011110100100111
Case 2: 00110111001011100001010111
Case 3: 111001011111110100100111000000
Case 4: 11100110011010010111
Case 5: 0011101000111001110000
Case 6: 111010111010110001111011

说明

1
1
通过提交
时空限制1000ms/128mb
题目来源2010湖大校赛
评测方式在线评测
题目类型
难        度