#1038. 【入门4】压缩技术(续集版)
【入门4】压缩技术(续集版)
说明
设某汉字由 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi><mo>×</mo><mi>�</mi></mrow></semantics></math>N×N 的 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mtext mathvariant="monospace">0</mtext></mrow></semantics></math>0 和 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mtext mathvariant="monospace">1</mtext></mrow></semantics></math>1 的点阵图案组成。
我们依照以下规则生成压缩码。连续一组数值:从汉字点阵图案的第一行第一个符号开始计算,按书写顺序从左到右,由上至下。第一个数表示连续有几个 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mtext mathvariant="monospace">0</mtext></mrow></semantics></math>0,第二个数表示接下来连续有几个 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mtext mathvariant="monospace">1</mtext></mrow></semantics></math>1,第三个数再接下来连续有几个 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mtext mathvariant="monospace">0</mtext></mrow></semantics></math>0,第四个数接着连续几个 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mtext mathvariant="monospace">1</mtext></mrow></semantics></math>1,以此类推……
例如: 以下汉字点阵图案:
0001000
0001000
0001111
0001000
0001000
0001000
1111111
对应的压缩码是: <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mtext mathvariant="monospace">7</mtext><mtext> </mtext><mtext mathvariant="monospace">3</mtext><mtext> </mtext><mtext mathvariant="monospace">1</mtext><mtext> </mtext><mtext mathvariant="monospace">6</mtext><mtext> </mtext><mtext mathvariant="monospace">1</mtext><mtext> </mtext><mtext mathvariant="monospace">6</mtext><mtext> </mtext><mtext mathvariant="monospace">4</mtext><mtext> </mtext><mtext mathvariant="monospace">3</mtext><mtext> </mtext><mtext mathvariant="monospace">1</mtext><mtext> </mtext><mtext mathvariant="monospace">6</mtext><mtext> </mtext><mtext mathvariant="monospace">1</mtext><mtext> </mtext><mtext mathvariant="monospace">6</mtext><mtext> </mtext><mtext mathvariant="monospace">1</mtext><mtext> </mtext><mtext mathvariant="monospace">3</mtext><mtext> </mtext><mtext mathvariant="monospace">7</mtext></mrow></semantics></math>7 3 1 6 1 6 4 3 1 6 1 6 1 3 7 (第一个数是 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi></mrow></semantics></math>N ,其余各位表示交替表示0和1 的个数,压缩码保证 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi><mo>×</mo><mi>�</mi><mo>=</mo></mrow></semantics></math>N×N= 交替的各位数之和)
输入格式
汉字点阵图(点阵符号之间不留空格)输出格式
输出一行,压缩码样例
0001000
0001000
0001111
0001000
0001000
0001000
1111111
7 3 1 6 1 6 4 3 1 6 1 6 1 3 7
提示
数据范围:
数据保证,
<math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>3</mn><mo>≤</mo><mi>�</mi><mo>≤</mo><mn>200</mn></mrow></semantics></math>3≤N≤200相关
在以下作业中: