mxyywjc @ 2024-07-24 17:21:36
input()
num = input()
_0 = [
'XXX',
'X.X',
'X.X',
'X.X',
'XXX'
]
_1 = [
'..X',
'..X',
'..X',
'..X',
'..X'
]
_2 = [
'XXX',
'..X',
'XXX',
'X..',
'XXX'
]
_3 = [
'XXX',
'..X',
'XXX',
'..X',
'XXX'
]
_4 = [
'X.X',
'X.X',
'XXX',
'..X',
'..X'
]
_5 = [
'XXX',
'X..',
'XXX',
'..X',
'XXX'
]
_6 = [
'XXX',
'X..',
'XXX',
'X.X',
'XXX'
]
_7 = [
'XXX',
'..X',
'..X',
'..X',
'..X'
]
_8 = [
'XXX',
'X.X',
'XXX',
'X.X',
'XXX'
]
_9 = [
'XXX',
'X.X',
'XXX',
'..X',
'XXX'
]
picWidth = 3
picHeight = 5
class charMap:
def __init__(self,width,height):
self.width = width
self.height = height
self.data = [list('.'*height) for count in range(0,width)]
def paste(self,x,y,pic):
startX = x
startY = y
for y in range(startY,startY + picHeight):
for x in range(startX,startX + picWidth):
self.data[x][y] = pic[y - startY][x - startX]
def show(self):
for y in range(0,self.height):
for x in range(0,self.width):
print(self.data[x][y],end='')
print()
numLen = len(num)
width = numLen * 3 + numLen - 1
height = picHeight
map = charMap(width,height)
def numToMap(number):
return [_0,_1,_2,_3,_4,_5,_6,_7,_8,_9][int(number)]
left = 0
while left < width:
pic = numToMap(num[i])
i += 1
map.paste(left,0,pic)
left += 4
map.show()
by jntmhh @ 2024-07-24 17:33:20
#include<cstdio>
using namespace std;
char c[10][5][4]=
{
"XXX",
"X.X",
"X.X",
"X.X",
"XXX",
"..X",
"..X",
"..X",
"..X",
"..X",
"XXX",
"..X",
"XXX",
"X..",
"XXX",
"XXX",
"..X",
"XXX",
"..X",
"XXX",
"X.X",
"X.X",
"XXX",
"..X",
"..X",
"XXX",
"X..",
"XXX",
"..X",
"XXX",
"XXX",
"X..",
"XXX",
"X.X",
"XXX",
"XXX",
"..X",
"..X",
"..X",
"..X",
"XXX",
"X.X",
"XXX",
"X.X",
"XXX",
"XXX",
"X.X",
"XXX",
"..X",
"XXX"
},ans[10][1000];
int main()
{
int n,a,s=0;
scanf("%d",&n);
while(n--)
{
scanf("%1d",&a);
for(int i=0;i<5;i++)
for(int j=0;j<3;j++)
ans[i][s+j]=c[a][i][j];
for(int i=0;i<5;i++) ans[i][s+3]='.';
s+=4;
}
for(int i=0;i<5;i++)
{
for(int j=0;j<s-1;j++)
printf("%c",ans[i][j]);
printf("\n");
}
return 0;
}
by jntmhh @ 2024-07-24 17:34:17
@mxyywjc
by mxyywjc @ 2024-07-24 17:48:59
@jntmhh 我怕抄袭灰色了
by Lele_Programmer @ 2024-07-24 17:49:15
@jntmhh 有没有一种可能,他用的是 py
by mxyywjc @ 2024-07-25 06:08:38
@Lele_Programmer py是什么
by Lele_Programmer @ 2024-07-25 08:40:20
@mxyywjc !???python
by mxyywjc @ 2024-07-25 11:31:14
@Lele_Programmer 蟒蛇?
by E303 @ 2024-07-27 16:49:55
@jntmhh 需要三维数组吗
#include<bits/stdc++.h>
using namespace std;
char a[10000];
string s[10];
int main(){
int n;
cin>>n;
for(int i=0;i<n;i++){
cin>>a[i];
if(a[i]=='0'){
s[0]+="XXX.";
s[1]+="X.X.";
s[2]+="X.X.";
s[3]+="X.X.";
s[4]+="XXX.";
}
if(a[i]=='1'){
s[0]+="..X.";
s[1]+="..X.";
s[2]+="..X.";
s[3]+="..X.";
s[4]+="..X.";
}
if(a[i]=='2'){
s[0]+="XXX.";
s[1]+="..X.";
s[2]+="XXX.";
s[3]+="X...";
s[4]+="XXX.";
}
if(a[i]=='3'){
s[0]+="XXX.";
s[1]+="..X.";
s[2]+="XXX.";
s[3]+="..X.";
s[4]+="XXX.";
}
if(a[i]=='4'){
s[0]+="X.X.";
s[1]+="X.X.";
s[2]+="XXX.";
s[3]+="..X.";
s[4]+="..X.";
}
if(a[i]=='5'){
s[0]+="XXX.";
s[1]+="X...";
s[2]+="XXX.";
s[3]+="..X.";
s[4]+="XXX.";
}
if(a[i]=='6'){
s[0]+="XXX.";
s[1]+="X...";
s[2]+="XXX.";
s[3]+="X.X.";
s[4]+="XXX.";
}
if(a[i]=='7'){
s[0]+="XXX.";
s[1]+="..X.";
s[2]+="..X.";
s[3]+="..X.";
s[4]+="..X.";
}
if(a[i]=='8'){
s[0]+="XXX.";
s[1]+="X.X.";
s[2]+="XXX.";
s[3]+="X.X.";
s[4]+="XXX.";
}
if(a[i]=='9'){
s[0]+="XXX.";
s[1]+="X.X.";
s[2]+="XXX.";
s[3]+="..X.";
s[4]+="XXX.";
}
}
for(int i=0;i<5;i++){
s[i]=s[i].substr(0,s[i].size()-1);
cout<<s[i]<<'\n';
}
}