Yns01 @ 2022-11-30 11:12:28
求大佬指点
#include<bits/stdc++.h>
using namespace std;
char b[1005];
char a[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;
int main()
{
cin>>n;
for(int i=0;i<n;i++)
cin>>b[i];
for(int i=0;i<=4;i++)//每一行
{
for(int j=0;j<=n-1;j++)//每一个数字
{
for(int k=0;k<=2;k++)//每一列
{cout<<a[b[j]-'0'][i][k];}
if(j!=n-1)cout<<'.';
}
cout<<endl;
}
return 0;
}
by _Nobody @ 2022-11-30 11:57:12
所以你想要洛谷返回的是MLE而非WA吗
by Yns01 @ 2022-11-30 12:05:00
@_Nobody 必须开的正好吗?为什么开a[12][6][4]就会爆WA?
by _Nobody @ 2022-11-30 12:08:27
@zzy2914622361 本地调试结果呢
by _Nobody @ 2022-11-30 12:11:13
for(int i=0;i<=4;i++)//每一行
{
for(int j=0;j<=n-1;j++)//每一个数字
{
for(int k=0;k<=2;k++)//每一列
{cout<<a[b[j]-'0'][i][k];}
if(j!=n-1)cout<<'.';
}
cout<<endl;
}
循环不应该是i<4
吗@zzy2914622361
by _Nobody @ 2022-11-30 12:11:32
@zzy2914622361 多循环一位乱码了
by _Nobody @ 2022-11-30 12:12:49
@zzy2914622361 第一行的循环