ZOJ的2016题Segmentation Fault求解!
#include"stdio.h"#include"string.h"
#define maxn 1000
int main()
{
int n,t;
scanf("%d\n",&n);
int i,j,k[n],l;
for(i=0;i<n;i++)
{
k[i]=1;
}
for(i=0;i<n;i++)
{
scanf("%d\n",&t);
char s[t][maxn];
for(j=0;j<t;j++)
fgets(s[j],sizeof(s[j]),stdin);
for(j=0;j<t;j++)
{
l=strlen(s[j]);
if(s[j][l-2]!=s[j+1][0]&&j<t-1)
{
k[i]=0;
}
}
}
for(i=0;i<n;i++)
if(k[i]==1)
printf("Ordering is possible.\n");
else
printf("The door cannot be opened.\n");
return 0;
}
是哪里的数组越界了吗?