# Answer to Question #53997 in Java | JSP | JSF for Praveenkumar

Question #53997

scanf("%d",&R);

for(i=1;i<=R;i++)

{

scanf("%d%d",&f[i],&s[i]);

if((f[i]<1&&f[i]>N)||(s[i]<1&&s[i]>N))

return 0;

}

for(i=1;i<=R;i++)

{

if(f1)

{

if(flag==0)

{

break;

}

else

flag=0;

}

if(f[i]-1>=1)

if(A[f[i]-1][s[i]]!='x')

flag=1;

if(f[i]+1<=N)

if(A[f[i]+1][s[i]]!='x')

flag=1;

if(s[i]-1>=1)

if(A[f[i]][s[i]-1]!='x')

flag=1;

if(s[i]+1<=N)

if(A[f[i]][s[i]+1]!='x')

flag=1;

f1=1;

}

if(flag==1)

printf("YES");

else

printf("NO");

return 0;

}

for(i=1;i<=R;i++)

{

scanf("%d%d",&f[i],&s[i]);

if((f[i]<1&&f[i]>N)||(s[i]<1&&s[i]>N))

return 0;

}

for(i=1;i<=R;i++)

{

if(f1)

{

if(flag==0)

{

break;

}

else

flag=0;

}

if(f[i]-1>=1)

if(A[f[i]-1][s[i]]!='x')

flag=1;

if(f[i]+1<=N)

if(A[f[i]+1][s[i]]!='x')

flag=1;

if(s[i]-1>=1)

if(A[f[i]][s[i]-1]!='x')

flag=1;

if(s[i]+1<=N)

if(A[f[i]][s[i]+1]!='x')

flag=1;

f1=1;

}

if(flag==1)

printf("YES");

else

printf("NO");

return 0;

}

Expert's answer

## Comments

## Leave a comment