ZOJ Problem Set - 1493
One of the widely-used technologies in voice signal compression is DPCM encoding.
The algorithm is very simple, yet it's quite effective in signal transferring.
with the initial condition: a0 = b0 = 0, where ai is an 8-bit unsigned integer
and bi is a 4-bit signed integer, the highest bit is used to represent its sign.
The input consists of several cases, each starts with an even number n (n <=
10000), indicating the number of the bytes to be processed, then followed by
n bytes in hex form.
For each test case, output the number of bytes in DPCM in a line, then output the n bytes in hex form, with 8 numbers per line.
Author: TANG, Jiqing
Source: ZOJ Monthly, February 2003