Home > Back-end >  Hope bosses guidance! I know I'm behind the program simulation part has a problem, but I don�
Hope bosses guidance! I know I'm behind the program simulation part has a problem, but I don�

Time:04-01

# include & lt; Stdio. H>
Int main () {
Int a, b=1, I, j, aa [7] [7], c [7];
The scanf (" % d \ n ", & amp; A);
While (a & gt; 0 {
For (j=1; J & lt;=2; J++) {
The scanf (" % s ", c);
Aa [j] [3]=c [0] - '0';
Aa [j] [1] - [4]=c '0'.
Aa [j] [5]=c [2] - '0';
}
For (j=3; J & lt;=5; J++) {
The scanf (" % s ", c);
Aa [j] [1]=c [0] - '0';
Aa [j] [1] [2]=c - '0';
Aa [j] [2] [3]=c - '0';
Aa [j] [3] [4]=c - '0';
Aa [j] [4] [5]=c - '0';
Aa [j] [5] [6]=c - '0';
Aa [j] [6] [7]=c - '0';
}
For (j=6; J & lt;=7. J++) {
The scanf (" % s ", c);
Aa [j] [3]=c [0] - '0';
Aa [j] [1] - [4]=c '0'.
Aa [j] [5]=c [2] - '0';
}
For (I=3; I & lt;=5; I++) {
For (j=1; J & lt;=2; J++) {
If (aa [I] [j]==1) {
If (aa [I] [j + 1)==1 & amp; & Aa [I] [m + 2]==0)
B=0;
If (aa + 1] [I [j]==1 & amp; & (aa + 2 [I] [j]==0 | | aa [j] [I - 1]==0))
B=0;
}
}
For (j=6; J & lt;=7. J++) {
If (aa [I] [j]==1) {
If (aa [I] [j + 1)==1 & amp; & Aa [I] [m + 2]==0)
B=0;
If (aa + 1] [I [j]==1 & amp; & (aa + 2 [I] [j]==0 | | aa [j] [I - 1]==0))
B=0;
}
}
}
For (I=1; I & lt;=7. I++) {
For (j=3; J & lt;=5; J++) {
If (aa [I] [j]==1) {
If (aa [I] [j + 1)==1 & amp; & (aa [I] [m + 2]==0 | | aa [I] [1]==0))
B=0;
If (aa + 1] [I [j]==1 & amp; & (aa + 2 [I] [j]==0 | | aa [j] [I - 1]==0))
B=0;
}
}
}
A -;
If (b==0)
Printf (" \ n ");
The else
Printf (" yes \ n ");
}
}

CodePudding user response:

Not is empty for each position to judge the direction of the up and down or so don't exist for two pieces?

CodePudding user response:

reference 1/f, zhao teacher reply:
is not empty for each position to judge the direction of the up and down or so don't exist for two pieces?

Mainly circulation problem, because the above two rows and the following two rows is not starting from scratch

CodePudding user response:

You look into this line not line ~ ~
 
# include & lt; Stdio. H>
Int main () {
Int I, j, n, flag;
Char data [9] [9]={} '\ 0';
The scanf (" % d \ n ", & amp; N);
While (n & gt; 0 {
The scanf (" % s % s ", data [1] + 3, data [2] + 3);
The scanf (" % s % s % s ", data [3] + 1, data [4] + 1, data [5] + 1);
The scanf (" % s % s ", data [6] + 3, data [7] + 3);
flag=0;
for(i=1; i<8; I++) {
For (j=1; j<8; J++) {
If (data [I] [j].='1') continue;//the current location not pieces skip
If (data [I - 1) [j]=='1' & amp; & Data [I + 1] [j]=='0'//vertical direction: 110
| | data [I - 1) [j]=='0' & amp; & Data [I + 1] [j]=='1'//vertical direction: 011
| | data [I] [1]=='1' & amp; & Data [I] [m + 1]=='0'//horizontal direction: 110
| | data [I] [1]=='0' & amp; & Data [I] [m + 1]=='1') {//horizontal direction: 011
flag=1;//the above four kinds of case that solution
break;
}
}
If (flag==1) break;
}
n--;
If (flag==1) printf (" no \ n ");
The else printf (" yes \ n ");
}
return 0;
}

CodePudding user response:

reference coo135 reply: 3/f
you look into this line not line ~ ~
 
# include & lt; Stdio. H>
Int main () {
Int I, j, n, flag;
Char data [9] [9]={} '\ 0';
The scanf (" % d \ n ", & amp; N);
While (n & gt; 0 {
The scanf (" % s % s ", data [1] + 3, data [2] + 3);
The scanf (" % s % s % s ", data [3] + 1, data [4] + 1, data [5] + 1);
The scanf (" % s % s ", data [6] + 3, data [7] + 3);
flag=0;
for(i=1; i<8; I++) {
For (j=1; j<8; J++) {
If (data [I] [j].='1') continue;//the current location not pieces skip
If (data [I - 1) [j]=='1' & amp; & Data [I + 1] [j]=='0'//vertical direction: 110
| | data [I - 1) [j]=='0' & amp; & Data [I + 1] [j]=='1'//vertical direction: 011
| | data [I] [1]=='1' & amp; & Data [I] [m + 1]=='0'//horizontal direction: 110
| | data [I] [1]=='0' & amp; & Data [I] [m + 1]=='1') {//horizontal direction: 011
flag=1;//the above four kinds of case that solution
break;
}
}
If (flag==1) break;
}
n--;
If (flag==1) printf (" no \ n ");
The else printf (" yes \ n ");
}
return 0;
}

Thanks for a great god
  • Related