Home > Back-end >  Uva1589XIangqi crazy for help bosses!!!!!! Udebug have, be WA! Fifty points for help!!!!!
Uva1589XIangqi crazy for help bosses!!!!!! Udebug have, be WA! Fifty points for help!!!!!

Time:10-13

#include
#include
Int n, x, y, q, p;
Int a [15] [15].//tag dangerous place, red themselves are safe, unless by other red lock,
Int b [15] [15].//mark the location of the red, one on behalf of the general, 2 on behalf of the chariot, 3, 4 run
Void handle_g (int x, int y);
Void handle_r (int x, int y);
Void handle_h (int x, int y);
Void handle_c (int x, int y);
Int main (int arg c, char * const argv [])
{
While (the scanf (" % d % d % d ", & amp; N, & amp; X, & amp; Y) & amp; & N) {
Q=0, p=0;
Memset (a, 0, sizeof (a));
Memset (b, 0, sizeof (b));
Int judge=0;
for (int i=0; I & lt; n; I++) {
char c;
Int x, y;
getchar();
The scanf (" % c % d % d ", & amp; C., & amp; X, & amp; Y);
If (c=='G')
B [x] [y]=1;
Else if (c=='R')
B [x] [y]=2;
Else if (c=='H')
B [x] [y]=3;
Else if (c=='c')
B [x] [y]=4;
}
for (int i=1; I & lt;=10; I++)
For (int j=1; J & lt;=9; J++) {
If (b [I] [j]==1)
{
Q=I;
P=j;
}
Else if (b [I] [j]==2)
Handle_r (I, j);
Else if (b [I] [j]==3)
Handle_h (I, j);
Else if (b [I] [j]==4)
Handle_c (I, j);
}
Handle_g (q, p);//prevent was flying to
If (x - 1 & gt;=1 & amp; & A [1] x [y]==0)
Judge=1;
Else if (x + 1 & lt;=3 & amp; & A [x + 1] [y]==0)
Judge=1;
Else if (y + 1 & lt;=6 & amp; & A [x] [y + 1)==0)
Judge=1;
Else if (y - 1 & gt;=4 & amp; & A [x] [1] y==0)
Judge=1;
Else if (a [x] [y]==2)
Judge=1;
If (judge)
Printf (" \ n ");
The else
Printf (" YES \ n ");
}
return 0;
}
Void handle_g (int x, int y) {//consider a single straight line will
For (int I=x - 1; I & gt;=1; I -) {//will fly down
If (b [I] [y]==0)
A [I] [y]=2;
The else {
A [I] [y]=2;
break;
}
}
}
Void handle_r (int x, int y) {//consider around the single linear chariot
For (int I=y - 1; I & gt;=1; I -)//left
{
If (b [x] [I]==0)
A [x] [I]=1;
The else {
A [x] [I]=1;
break;
}
}
For (int I=y + 1; I & lt;=9; I++)//to the right
{
If (b [x] [I]==0)
A [x] [I]=1;
The else {
A [x] [I]=1;
break;
}
}
For (int I=x - 1; I & gt;=1; I -)//up
{
If (b [I] [y]==0)
A [I] [y]=1;
The else {
A [I] [y]=1;
break;
}
}
For (int I=x + 1; I & lt;=10; I++) {//down
If (b [I] [y]==0)
A [I] [y]=1;
The else {
A [I] [y]=1;
break;
}
}
}
Void handle_h (int x, int y) {//ma
If (y + 2 & lt;=9 & amp; & B [x] [y + 1)==0) {//right
If (x - 1 & gt;
=1)[y] a [x - 1 + 2)=1;
If (x + 1 & lt;=10)
A [x + 1] [y + 2]=1;
}
If (y - 2 & gt;=1 & amp; & B [x] [1] y==0) {//the left
If (x - 1 & gt;
=1)[y] a [x - 1-2]=1;
If (x + 1 & lt;=10)
A [x + 1] [2] y=1;
}
If (x - 2 & gt;=1 & amp; & B [1] x [y]==0)//the above
{
If (y - 1 & gt;
=1)A [x - 2] [1] y=1;
If (y + 1 & lt;=9)
A [x - 2] [y + 1)=1;
}
If (x + 2 & lt;=10 & amp; & B [x + 1] [y]==0)//the following
{
If (y - 1 & gt;
=1)A [x + 2] [1] y=1;
If (y + 1 & lt;=9)
A [x + 2] [y + 1)=1;
}

}
Void handle_c (int x, int y) {
For (int I=x + 1; I & lt;=10; I++)//down
{
If (b [I] [y]!=0) {
For (int j=I + 1; J & lt;=10; J++) {
A [j] [y]=1;
If (b [j] [y]!=0)
break;
}
break;
}
}
For (int I=x - 1; I & gt;=1; I -)//up
{
If (b [I] [y]!=0) {
For (int j=I - 1; J & gt;=1; J -) {
A [j] [y]=1;
If (b [j] [y]!=0)
break;
}
break;
}
}
For (int I=y + 1; I & lt;=9; I++)//to the right
{
If (b [x] [I]!=0) {
For (int j=I + 1; J & lt;=9; J++) {
A [x] [j]=1;
If (b [x] [j].=0)
break;
}
break;
}
}
For (int I=y - 1; I & gt;=1; I -) {//left
If (b [x] [I]!=0) {
For (int j=I - 1; J & gt;=1; J -) {
A [x] [j]=1;
If (b [x] [j].=0)
break;
}
}
break;
}
}

CodePudding user response:

Ten hours, have withered

CodePudding user response:

This is really abnormal condition, is a simulation, is too much... Give it up
  • Related