xkdd @ 2023-12-27 21:18:26
#include<bits/stdc++.h>
using namespace std;
char xsp[305][7];
int main() {
char a[105];int n,cnti=1,cntj=1;cin>>n;
for(int i=0;i<n;i++){
cin>>a[i];
if(a[i]=='0')
xsp[cnti][cntj]='X',xsp[cnti][cntj+1]='X',xsp[cnti][cntj+2]='X',xsp[cnti+1][cntj]='X',xsp[cnti+1][cntj+2]='X',xsp[cnti+2][cntj]='X',xsp[cnti+2][cntj+2]='X',xsp[cnti+3][cntj+2]='X',xsp[cnti+3][cntj]='X',xsp[cnti+4][cntj]='X',xsp[cnti+4][cntj+2]='X',xsp[cnti+1][cntj+1]='.',xsp[cnti+2][cntj+1]='.',xsp[cnti+3][cntj+1]='.',xsp[cnti+4][cntj+1]='X';
else if(a[i]=='1')
xsp[cnti][cntj]='.',xsp[cnti][cntj+1]='.',xsp[cnti+1][cntj]='.',xsp[cnti+1][cntj+1]='.',xsp[cnti+2][cntj]='.',xsp[cnti+2][cntj+1]='X',xsp[cnti+3][cntj]='.',xsp[cnti+3][cntj+1]='.',xsp[cnti+4][cntj]='.',xsp[cnti+4][cntj+1]='.',xsp[cnti+4][cntj+2]='X',xsp[cnti+1][cntj+2]='X',xsp[cnti+2][cntj+2]='X',xsp[cnti+3][cntj+2]='X',xsp[cnti][cntj+2]='X';
else if(a[i]=='2')
xsp[cnti][cntj]='X',xsp[cnti][cntj+1]='X',xsp[cnti][cntj+2]='X',xsp[cnti+1][cntj]='.',xsp[cnti+1][cntj+2]='X',xsp[cnti+2][cntj]='X',xsp[cnti+2][cntj+2]='X',xsp[cnti+3][cntj+2]='.',xsp[cnti+3][cntj]='X',xsp[cnti+4][cntj]='X',xsp[cnti+4][cntj+2]='X',xsp[cnti+1][cntj+1]='.',xsp[cnti+2][cntj+1]='X',xsp[cnti+3][cntj+1]='.',xsp[cnti+4][cntj+1]='X';
else if(a[i]=='3')
xsp[cnti][cntj]='X',xsp[cnti][cntj+1]='X',xsp[cnti][cntj+2]='X',xsp[cnti+1][cntj]='.',xsp[cnti+1][cntj+2]='X',xsp[cnti+2][cntj]='X',xsp[cnti+2][cntj+2]='X',xsp[cnti+3][cntj+2]='X',xsp[cnti+3][cntj]='.',xsp[cnti+4][cntj]='X',xsp[cnti+4][cntj+2]='X',xsp[cnti+1][cntj+1]='.',xsp[cnti+2][cntj+1]='X',xsp[cnti+3][cntj+1]='.',xsp[cnti+4][cntj+1]='X';
else if(a[i]=='4')
xsp[cnti][cntj]='X',xsp[cnti][cntj+1]='.',xsp[cnti][cntj+2]='X',xsp[cnti+1][cntj]='X',xsp[cnti+1][cntj+2]='X',xsp[cnti+2][cntj]='X',xsp[cnti+2][cntj+2]='X',xsp[cnti+3][cntj+2]='X',xsp[cnti+3][cntj]='.',xsp[cnti+4][cntj]='.',xsp[cnti+4][cntj+2]='X',xsp[cnti+1][cntj+1]='.',xsp[cnti+2][cntj+1]='X',xsp[cnti+3][cntj+1]='.',xsp[cnti+4][cntj+1]='.';
else if(a[i]=='5')
xsp[cnti][cntj]='X',xsp[cnti][cntj+1]='X',xsp[cnti][cntj+2]='X',xsp[cnti+1][cntj]='X',xsp[cnti+1][cntj+2]='.',xsp[cnti+2][cntj]='X',xsp[cnti+2][cntj+2]='X',xsp[cnti+3][cntj+2]='X',xsp[cnti+3][cntj]='.',xsp[cnti+4][cntj]='X',xsp[cnti+4][cntj+2]='X',xsp[cnti+1][cntj+1]='.',xsp[cnti+2][cntj+1]='X',xsp[cnti+3][cntj+1]='.',xsp[cnti+4][cntj+1]='X';
else if(a[i]=='6')
xsp[cnti][cntj]='X',xsp[cnti][cntj+1]='X',xsp[cnti][cntj+2]='X',xsp[cnti+1][cntj]='X',xsp[cnti+1][cntj+2]='.',xsp[cnti+2][cntj]='X',xsp[cnti+2][cntj+2]='X',xsp[cnti+3][cntj+2]='X',xsp[cnti+3][cntj]='X',xsp[cnti+4][cntj]='X',xsp[cnti+4][cntj+2]='X',xsp[cnti+1][cntj+1]='.',xsp[cnti+2][cntj+1]='X',xsp[cnti+3][cntj+1]='.',xsp[cnti+4][cntj+1]='X';
else if(a[i]=='7')
xsp[cnti][cntj]='X',xsp[cnti][cntj+1]='X',xsp[cnti][cntj+2]='X',xsp[cnti+1][cntj]='.',xsp[cnti+1][cntj+2]='X',xsp[cnti+2][cntj]='.',xsp[cnti+2][cntj+2]='X',xsp[cnti+3][cntj+2]='X',xsp[cnti+3][cntj]='.',xsp[cnti+4][cntj]='.',xsp[cnti+4][cntj+2]='X',xsp[cnti+1][cntj+1]='.',xsp[cnti+2][cntj+1]='.',xsp[cnti+3][cntj+1]='.',xsp[cnti+4][cntj+1]='.';
else if(a[i]=='8')
xsp[cnti][cntj]='X',xsp[cnti][cntj+1]='X',xsp[cnti][cntj+2]='X',xsp[cnti+1][cntj]='X',xsp[cnti+1][cntj+2]='X',xsp[cnti+2][cntj]='X',xsp[cnti+2][cntj+2]='X',xsp[cnti+3][cntj+2]='X',xsp[cnti+3][cntj]='X',xsp[cnti+4][cntj]='X',xsp[cnti+4][cntj+2]='X',xsp[cnti+1][cntj+1]='.',xsp[cnti+2][cntj+1]='X',xsp[cnti+3][cntj+1]='.',xsp[cnti+4][cntj+1]='X';
else if(a[i]=='9')
xsp[cnti][cntj]='X',xsp[cnti][cntj+1]='X',xsp[cnti][cntj+2]='X',xsp[cnti+1][cntj]='X',xsp[cnti+1][cntj+2]='X',xsp[cnti+2][cntj]='X',xsp[cnti+2][cntj+2]='X',xsp[cnti+3][cntj+2]='X',xsp[cnti+3][cntj]='.',xsp[cnti+4][cntj]='.',xsp[cnti+4][cntj+2]='X',xsp[cnti+1][cntj+1]='.',xsp[cnti+2][cntj+1]='X',xsp[cnti+3][cntj+1]='.',xsp[cnti+4][cntj+1]='.';
cntj+=3;
}
for(int i=1;i<=5;i++){
for(int j=1;j<=cntj;j++){cout<<xsp[i][j];}
cout<<endl;
}
return 0;
}
by Shen_Linwood @ 2023-12-27 22:08:31
@xkdd
注意每个数字之间都有一列间隔。
您没有打空列
另外,“1”的点阵打错了一个点,您可以用
1
1
这组数据自测一下
by Shen_Linwood @ 2023-12-27 22:13:35
@xkdd 您的写法好抽象……
您可以看看题解,有好写得多的做法
by xkdd @ 2023-12-28 12:03:33
thanks
by xkdd @ 2023-12-28 12:29:57
A了,此帖结