Skip to content

Commit 47b72c7

Browse files
committed
20220118-40
1 parent aeba177 commit 47b72c7

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

1018

49 KB
Binary file not shown.

1018.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include <iostream>
2+
3+
int main(){
4+
int n, m;
5+
char b[51][51];
6+
scanf("%d%d", &n, &m);
7+
for(int i=0;i<n;i++){
8+
scanf("%s", b[i]);
9+
}
10+
11+
int min=10000000;
12+
for(int sx=0;sx<=n-8;sx++){
13+
for(int sy=0;sy<=m-8;sy++){
14+
int wrong=0;
15+
for(int i=sx;i<sx+8;i++){
16+
for(int j=sy;j<sy+8;j++){
17+
if((i+j)%2==0 && b[i][j]=='B') wrong++;
18+
else if((i+j)%2==1 && b[i][j]=='W') wrong++;
19+
}
20+
}
21+
wrong=(wrong<64-wrong)?wrong:64-wrong;
22+
if(wrong<min) min=wrong;
23+
}
24+
}
25+
printf("%d\n", min);
26+
27+
}

1389_2

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)