wzy3130601449 @ 2022-04-30 17:12:42
#include<stdio.h>
int main(){
char a[5][10][5]={"XXX","..X","XXX","XXX","X.X","XXX","XXX","XXX","XXX","XXX",
"X.X","..X","..X","..X","X.X","X..","X..","..X","X.X","X.X",
"X.X","..X","XXX","XXX","XXX","XXX","XXX","..X","XXX","XXX",
"X.X","..X","X..","..X","..X","..X","X.X","..X","X.X","..X",
"XXX","..X","XXX","XXX","..X","XXX","XXX","..X","XXX","X.X"};
int n,i,j;
scanf("%d",&n);
char str[n];
for(i=0;i<n;i++)
scanf(" %c",&str[i]);
for(j=0;j<5;j++)
for(i=0;i<n;i++)
printf("%s%s%s",(i?".":""),a[j][(int)(str[i]-'0')],(i==n-1?"\n":""));
return 0;
}
by qip101 @ 2022-04-30 17:56:36
@wzy3130601449 你构造一组数据11223发现你的输出开头是有打点的但是应该没有
by wzy3130601449 @ 2022-04-30 17:57:12
@MLBZSSK
by qip101 @ 2022-04-30 17:58:26
@wzy3130601449 构造以1开头的数据看看
by qip101 @ 2022-04-30 17:59:02
@wzy3130601449 不能只测试题目给的样例啊!
by wzy3130601449 @ 2022-04-30 18:00:50
@MLBZSSK
by qip101 @ 2022-04-30 18:01:52
@wzy3130601449 对啊开头不能打点你这个数组处理的不对自己再想想
by wzy3130601449 @ 2022-04-30 18:02:14
@MLBZSSK 这个是我代码运行的结果,我再给你看看正确代码运行的结果
by qip101 @ 2022-04-30 18:04:23
@wzy3130601449 额那我就不知了
by wzy3130601449 @ 2022-04-30 18:05:30
@MLBZSSK
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
using namespace std;
char W[10][5][3]=//W[i][j][k]表示第i个数字的第j行的第k列,(手打累死了)
{
{//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;//输入n
for(int i=0;i<n;i++){
cin>>s[i];//输入要打印的字符
}
for(int i=0;i<5;i++){//枚举每一行
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;
}
这是真确的代码运行结果和代码
by wzy3130601449 @ 2022-04-30 19:50:12
@MLBZSSK 我知道我错哪了!?,我九没画对,九最后一行漏了一个X,嘿嘿嘿,我交了几十次了,不过也要谢谢你,帮我看了这么久,打扰到你了。