汉字的字形存在于字库中,即便在今天,16点阵的字库也仍然使用广泛。
16点阵的字库把每个汉字看成是16x16个像素信息。并把这些信息记录在字节中。一个字节可以存储8位信息,用32个字节就可以存一个汉字的字形了。
把每个字节转为2进制表示,1表示墨迹,0表示底色。每行2个字节,
一共16行,布局是:第1字节,第2字节
第3字节,第4字节
….
第31字节, 第32字节这道题目是给你一段多个汉字组成的信息,每个汉字用32个字节表示,这里给出了字节作为有符号整数的值。
题目的要求隐藏在这些信息中。你的任务是复原这些汉字的字形,从中看出题目的要求,并根据要求填写答案。
这段信息是(一共10个汉字):
4 0 4 0 4 0 4 32 -1 -16 4 32 4 32 4 32 4 32 4 32 8 32 8 32 16 34 16 34 32 30 -64 0
16 64 16 64 34 68 127 126 66 -124 67 4 66 4 66 -124 126 100 66 36 66 4 66 4 66 4 126 4 66 40 0 16
4 0 4 0 4 0 4 32 -1 -16 4 32 4 32 4 32 4 32 4 32 8 32 8 32 16 34 16 34 32 30 -64 0
0 -128 64 -128 48 -128 17 8 1 -4 2 8 8 80 16 64 32 64 -32 64 32 -96 32 -96 33 16 34 8 36 14 40 4
4 0 3 0 1 0 0 4 -1 -2 4 0 4 16 7 -8 4 16 4 16 4 16 8 16 8 16 16 16 32 -96 64 64
16 64 20 72 62 -4 73 32 5 16 1 0 63 -8 1 0 -1 -2 0 64 0 80 63 -8 8 64 4 64 1 64 0 -128
0 16 63 -8 1 0 1 0 1 0 1 4 -1 -2 1 0 1 0 1 0 1 0 1 0 1 0 1 0 5 0 2 0
2 0 2 0 7 -16 8 32 24 64 37 -128 2 -128 12 -128 113 -4 2 8 12 16 18 32 33 -64 1 0 14 0 112 0
1 0 1 0 1 0 9 32 9 16 17 12 17 4 33 16 65 16 1 32 1 64 0 -128 1 0 2 0 12 0 112 0
0 0 0 0 7 -16 24 24 48 12 56 12 0 56 0 -32 0 -64 0 -128 0 0 0 0 1 -128 3 -64 1 -128 0 0注意:需要提交的是一个整数,不要填写任何多余内容。
这道题就是计算十进制的二进制补码。然后看输出结果里面蕴藏的信息。
#include
using namespace std;
int ans[10000][8];
int a[] = {
4,0,4,0,4,0,4,32,-1,-16,4,32,4,32,4,32,
4,32,4,32,8,32,8,32,16,34,16,34,32,30,
-64,0,16,64,16,64,34,68,127,126,66,-124,
67,4,66,4,66,-124,126,100,66,36,66,4,66,
4,66,4,126,4,66,40,0,16,4,0,4,0,4,0,4,32,
-1,-16,4,32,4,32,4,32,4,32,4,32,8,32,8,32,
16,34,16,34,32,30,-64,0,0,-128,64,-128,48,
-128,17,8,1,-4,2,8,8,80,16,64,32,64,-32,64,
32,-96,32,-96,33,16,34,8,36,14,40,4,4,0,3,0,
1,0,0,4,-1,-2,4,0,4,16,7,-8,4,16,4,16,4,16,8,
16,8,16,16,16,32,-96,64,64,16,64,20,72,62,-4,
73,32,5,16,1,0,63,-8,1,0,-1,-2,0,64,0,80,63,
-8,8,64,4,64,1,64,0,-128,0,16,63,-8,1,0,1,0,1,
0,1,4,-1,-2,1,0,1,0,1,0,1,0,1,0,1,0,1,0,5,0,2,
0,2,0,2,0,7,-16,8,32,24,64,37,-128,2,-128,12,
-128,113,-4,2,8,12,16,18,32,33,-64,1,0,14,0,112,
0,1,0,1,0,1,0,9,32,9,16,17,12,17,4,33,16,65,16,1,
32,1,64,0,-128,1,0,2,0,12,0,112,0,0,0,0,0,7,-16,
24,24,48,12,56,12,0,56,0,-32,0,-64,0,-128,0,0,0,0,
1,-128,3,-64,1,-128,0,0,
};
int tenTo2(int i , int num){
if(i >= 0){
int cnt = 0;
while(i != 0){
ans[num][cnt++] = i % 2;
i /= 2;
}
}else if(i < 0){
ans[num][7] = 1;
i = -i;
int cnt = 0;
while(i != 0){
ans[num][cnt++] = i % 2;
i /= 2;
}
if(ans[num][0] == 0){
ans[num][0] = 1;
}else if(ans[num][0] == 1){
ans[num][0] = 0;
int flag = 1;
for(int i = 1;i < 7;i++){
if(ans[num][i] == 0){
ans[num][i] = 1;
}else if(ans[num][i] == 1){
ans[num][i] = 0;
}
}
if(a[0] == 0){
a[0] = 1;
}else if(a[0] == 1){
a[0] = 0;
a[1] = 2;
for(int i = 1;i < 6;i++){
if(a[i] == 2){
a[i] = 0;
a[i + 1] += 1;
}
}
if(a[7] == 2){
a[7] = 0;
}
}
}
}
}
int main(){
int n;
for(int i = 0;i < 320;i++){
tenTo2(a[i] , i);
}
for(int i = 0;i < 320;i += 2){
for(int j = 7;j >= 0;j--){
cout << ans[i][j];
}
for(int j = 7;j >= 0;j--){
cout << ans[i + 1][j];
}
cout << endl;
}
return 0;
}
一开始真没看出来。。把眼镜摘了我才看清楚。。很尴尬
0000010000000000
0000010000000000
0000010000000000
0000010000100000
1111111010010001
0000010000100000
0000010000100000
0000010000100000
0000010000100000
0000010000100000
0000100000100000
0000100000100000
0001000000100010
0001000000100010
0010000000011110
1100000100000000
0001000001000000
0001000001000000
0010001001000100
0111111101111110
0100001011111101
0100001100000100
0100001000000100
0100001011111101
0111111001100100
0100001000100100
0100001000000100
0100001000000100
0100001000000100
0111111000000100
0100001000101000
0000000000010000
0000010000000000
0000010000000000
0000010000000000
0000010000100000
1111111010010001
0000010000100000
0000010000100000
0000010000100000
0000010000100000
0000010000100000
0000100000100000
0000100000100000
0001000000100010
0001000000100010
0010000000011110
1100000100000000
0000000010000001
0100000010000001
0011000010000001
0001000100001000
0000000110000101
0000001000001000
0000100001010000
0001000001000000
0010000001000000
1010000101000000
0010000011100001
0010000011100001
0010000100010000
0010001000001000
0010010000001110
0010100000000100
0000010000000000
0000001100000000
0000000100000000
0000000000000100
1111111010000011
0000010000000000
0000010000010000
0000011110001001
0000010000010000
0000010000010000
0000010000010000
0000100000010000
0000100000010000
0001000000010000
0010000011100001
0100000001000000
0001000001000000
0001010001001000
0011111010000101
0100100100100000
0000010100010000
0000000100000000
0011111110001001
0000000100000000
1111111010000011
0000000001000000
0000000001010000
0011111110001001
0000100001000000
0000010001000000
0000000101000000
0000000010000001
0000000000010000
0011111110001001
0000000100000000
0000000100000000
0000000100000000
0000000100000100
1111111010000011
0000000100000000
0000000100000000
0000000100000000
0000000100000000
0000000100000000
0000000100000000
0000000100000000
0000010100000000
0000001000000000
0000001000000000
0000001000000000
0000011110010001
0000100000100000
0001100001000000
0010010110000001
0000001010000001
0000110010000001
0111000110000101
0000001000001000
0000110000010000
0001001000100000
0010000111000001
0000000100000000
0000111000000000
0111000000000000
0000000100000000
0000000100000000
0000000100000000
0000100100100000
0000100100010000
0001000100001100
0001000100000100
0010000100010000
0100000100010000
0000000100100000
0000000101000000
0000000010000001
0000000100000000
0000001000000000
0000110000000000
0111000000000000
0000000000000000
0000000000000000
0000011110010001
0001100000011000
0011000000001100
0011100000001100
0000000000111000
0000000010100001
0000000011000001
0000000010000001
0000000000000000
0000000000000000
0000000110000001
0000001111000001
0000000110000001
0000000000000000
387420489