lvyonghuan @ 2022-10-10 12:04:43
#include <stdio.h>
int main()
{
int n;
scanf("%d",&n);
int A[n];
for(int i=0;i<n;i++)
{
scanf("%1d",&A[i]);
}
char result[5][3*n+n];
int count1=0;
for(int count=0;count<n;count++)
{
switch (A[count])
{
case 0:
for(int i=0;i<3;i++)
{
if(i==0||i==2)
{
result[0][count1]=result[1][count1]=result[2][count1]=result[3][count1]=result[4][count1]='X';
count1++;
}
else if(i==1)
{
result[0][count1]=result[4][count1]='X',result[1][count1]=result[2][count1]=result[3][count1]='.';
count1++;
}
}
break;
case 1:
for(int i=0;i<3;i++)
{
if(i==0||i==1)
{
result[0][count1]=result[1][count1]=result[2][count1]=result[3][count1]=result[4][count1]='.';
count1++;
}
else if(i==2)
{
result[0][count1]=result[1][count1]=result[2][count1]=result[3][count1]=result[4][count1]='X';
count1++;
}
}
break;
case 2:
for(int i=0;i<3;i++)
{
if(i==0)
{
result[0][count1]=result[2][count1]=result[3][count1]=result[4][count1]='X',result[1][count1]='.';
count1++;
}
else if(i==1)
{
result[0][count1]=result[2][count1]=result[4][count1]='X',result[1][count1]=result[3][count1]='.';
count1++;
}
if(i==2)
{
result[0][count1]=result[1][count1]=result[2][count1]=result[4][count1]='X',result[3][count1]='.';
count1++;
}
}
break;
case 3:
for(int i=0;i<3;i++)
{
if(i==0||i==1)
{
result[0][count1]=result[2][count1]=result[4][count1]='X',result[1][count1]=result[3][count1]='.';
count1++;
}
else if(i==2)
{
result[0][count1]=result[1][count1]=result[2][count1]=result[3][count1]=result[4][count1]='X';
count1++;
}
}
break;
case 4:
for(int i=0;i<3;i++)
{
if(i==1)
{
result[0][count1]=result[1][count1]=result[4][count1]=result[3][count1]='.',result[2][count1]='X';
count1++;
}
else if(i==2)
{
result[0][count1]=result[1][count1]=result[2][count1]=result[3][count1]=result[4][count1]='X';
count1++;
}
else if(i==0)
{
result[0][count1]=result[1][count1]=result[2][count1]='X',result[3][count1]=result[4][count1]='.';
count1++;
}
}
break;
case 5:
for(int i=0;i<3;i++)
{
if(i==2)
{
result[0][count1]=result[2][count1]=result[3][count1]=result[4][count1]='X',result[1][count1]='.';
count1++;
}
else if(i==1)
{
result[0][count1]=result[2][count1]=result[4][count1]='X',result[1][count1]=result[3][count1]='.';
count1++;
}
if(i==0)
{
result[0][count1]=result[1][count1]=result[2][count1]=result[4][count1]='X',result[3][count1]='.';
count1++;
}
}
break;
case 6:
for(int i=0;i<3;i++)
{
if(i==2)
{
result[0][count1]=result[2][count1]=result[4][count1]=result[3][count1]='X',result[1][count1]='.';
count1++;
}
else if(i==0)
{
result[0][count1]=result[1][count1]=result[2][count1]=result[3][count1]=result[4][count1]='X';
count1++;
}
else if(i==1)
{
result[0][count1]=result[4][count1]=result[2][count1]='X',result[3][count1]=result[1][count1]='.';
count1++;
}
}
case 7:
for(int i=0;i<3;i++)
{
if(i==0||i==1)
{
result[1][count1]=result[2][count1]=result[4][count1]=result[3][count1]='.',result[0][count1]='X';
count1++;
}
else if(i==2)
{
result[0][count1]=result[1][count1]=result[2][count1]=result[3][count1]=result[4][count1]='X';
count1++;
}
}
break;
case 8:
for(int i=0;i<3;i++)
{
if(i==0||i==2)
{
result[1][count1]=result[2][count1]=result[4][count1]=result[3][count1]=result[0][count1]='X';
count1++;
}
else if(i==1)
{
result[0][count1]=result[4][count1]=result[2][count1]='X',result[3][count1]=result[1][count1]='.';
count1++;
}
}
break;
case 9:
for(int i=0;i<3;i++)
{
if(i==0)
{
result[0][count1]=result[2][count1]=result[1][count1]=result[4][count1]='X',result[3][count1]='.';
count1++;
}
else if(i==2)
{
result[0][count1]=result[1][count1]=result[2][count1]=result[3][count1]=result[4][count1]='X';
count1++;
}
else if(i==1)
{
result[0][count1]=result[4][count1]=result[2][count1]='X',result[3][count1]=result[1][count1]='.';
count1++;
}
}
}
result[0][count1]=result[1][count1]=result[2][count1]=result[3][count1]=result[4][count1]='.';
count1++;
}
for(int j=0;j<5;j++)
{
for(int i=0;i<3*n+n-1;i++)
{
printf("%c",result[j][i]);
}
printf("\n");
}
return 0;
}
by lvyonghuan @ 2022-10-10 12:06:04
(虽然我知道这么写浪费时间,不过既然都这么写了,还请各位佬帮本蒟蒻看看为什么会错)
by lvyonghuan @ 2022-10-10 15:15:07
破案了,6那里少了个break 没事了,不过代码还是摆在这里给大家看看