Files
python/TangDou/LuoGuBook/L5_10.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

101 lines
2.6 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <bits/stdc++.h>
using namespace std;
char W[10][5][3] = { //10个数字每个数字5行3列
{//0
'X', 'X', 'X',
'X', '.', 'X',
'X', '.', 'X',
'X', '.', 'X',
'X', 'X', 'X',
},
{//1
'.', '.', 'X',
'.', '.', 'X',
'.', '.', 'X',
'.', '.', 'X',
'.', '.', 'X',
},
{//2
'X', 'X', 'X',
'.', '.', 'X',
'X', 'X', 'X',
'X', '.', '.',
'X', 'X', 'X',
},
{//3
'X', 'X', 'X',
'.', '.', 'X',
'X', 'X', 'X',
'.', '.', 'X',
'X', 'X', 'X',
},
{//4
'X', '.', 'X',
'X', '.', 'X',
'X', 'X', 'X',
'.', '.', 'X',
'.', '.', 'X',
},
{//5
'X', 'X', 'X',
'X', '.', '.',
'X', 'X', 'X',
'.', '.', 'X',
'X', 'X', 'X',
},
{//6
'X', 'X', 'X',
'X', '.', '.',
'X', 'X', 'X',
'X', '.', 'X',
'X', 'X', 'X',
},
{//7
'X', 'X', 'X',
'.', '.', 'X',
'.', '.', 'X',
'.', '.', 'X',
'.', '.', 'X',
},
{//8
'X', 'X', 'X',
'X', '.', 'X',
'X', 'X', 'X',
'X', '.', 'X',
'X', 'X', 'X',
},
{//9
'X', 'X', 'X',
'X', '.', 'X',
'X', 'X', 'X',
'.', '.', 'X',
'X', 'X', 'X',
}
};
int n;
char s[110];
int main() {
cin >> n;
for (int i = 0; i < n; i++)
cin >> s[i];
//因为C++的输出是按行输出的,所以要用一些技巧
//1、枚举每一行
for (int i = 0; i < 5; i++) {
//2、枚举每一个数字
for (int j = 0; j < n; j++) {
for (int k = 0; k < 3; k++) //枚举每个数字的列
cout << W[s[j] - '0'][i][k];//输出因为s[j]为字符,所以要减去'0'
//如果最后一列,就不需要打印'.'
if (j != n - 1) cout << '.';
}
cout << endl;
}
return 0;
}