编译错误,但是怎么也找不出来
查看原帖
编译错误,但是怎么也找不出来
703660
canadian_people楼主2023/3/9 20:27
#include <bits/stdc++.h>
using namespace std;
int n,i,j,x,y,s,t;
int f[10][8]={
	{6,0,1,2,4,5,6},{2,2,5},{5,0,2,3,4,6},{5,0,2,3,5,6},
	{4,1,2,3,5},{5,0,1,3,5,6},{6,0,1,3,4,5,6},{3,0,2,5},
	{7,0,1,2,3,4,5,6},{6,0,1,2,3,5,6}
};
int d[7][3][2]={
	{{0,0},{0,1},{0,2}},
	{{0,0},{1,0},{2,0}},
	{{0,2},{1,2},{2,2}},
	{{2,0},{2,1},{2,2}},
	{{2,0},{3,0},{4,0}},
	{{2,2},{3,2},{4,2}},
	{{4,0},{4,1},{4,2}}
};
char a[101],c[5][500];
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	cin>>n>>a+1;
	for(i=1;i<=5;i++)
		for(j=1;j<=4*n-1;j++) c[i][j]='.';
	for(i=1;i<=n;i++){
		x=0;y=i*4;s=a[i]-'0';
		for(j=1;j<=f[s][0];j++){
			t=f[s][j];
			c[x+s[t][0][0]][y+d[t][0][1]]='X';
			c[x+s[t][1][0]][y+d[t][1][1]]='X';
			c[x+s[t][2][0]][y+d[t][2][1]]='X';
		}
	}
	for(i=1;i<=5;i++,cout<<"\n")
		for(j=1;j<=4*n-1;j++) cout<<c[i][j];
}

编译错误,

报错:

[Error] invalid types 'int[int]' for array subscript
2023/3/9 20:27
加载中...