BELOW WRITTEN TEXT WAS MY CODE FOR THE SHOOTING QUESTION FOR AUGUST COOK OFF-2014
THE CODE WORKS ON MY COMPILER IF I TAKE TEST CASE=1 BUT DOES NOT LET ME INPUT ALL THE ARRAY ELEMENTS IF I TAKE REST CASES MORE THAN 1.
I TRIED CHECKING IT FOR ALL 3 SAMPLE INPUT-OUTPUT VALUES
EVERYTHING SEEMS OKAY.
CAN SOMEONE EXPLAIN ME THE FAULT IN THE CODE, IF ANY
#include<stdio.h>
int main()
{
int i,j,n,m,t,x,z,flag;char arr[50][50];
scanf("%d",&t);
for(z=1;z<=t;z++)
{
flag=0;
scanf("%d%d",&n,&m);
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
scanf("%ch",&arr[i][j]);
}
}
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
if(arr[i][j]==‘L’)
{
for(x=0;x<=j;x++)
if(arr[i][x]==‘E’)
arr[i][x]=’.’;
for(x=j;x<m;x++)
if(arr[i][x]=='E')
arr[i][x]='.';
for(x=0;x<=i;x++)
if(arr[x][j]=='E')
arr[x][j]='.';
}
}
}
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
if(arr[i][j]==‘E’)
flag++;
}
}
if(flag==0)
printf(“impossible\n”);
else
printf(“possible\n”);
}
return 0;
}