原题链接

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
int num, res = inf;
void p(int x) {
for(int i = 0; i < 4; ++i) {
for(int j = 0; j < 4; ++j) {
printf("%d", (x >> (4 * i + j)) & 1);
}
printf("\n");
}
printf("\n");
}
int main() {
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
#endif
for(int i = 0; i < 4; ++i) {
string s;
cin >> s;
for(int j = 0; j < 4; ++j) {
if(s[j] == '+')
num |= (1 << (i * 4 + j));
}
}
// p(num);
int ptr = 0;
for(int i = 0; i < 1 << 16; ++i) {
int times = 0;
int temp = num;
for(int j = 0; j < 16; ++j) {
if((i >> j) & 1) {
times++;
// p(temp);
int column = j % 4;
int row = j / 4;
// printf("row: %d, column: %d\n", row, column);
int n = 0xf << (4 * row);
n |= 0x1111 << column;
temp ^= n;
// temp ^= 1 << j;
//p(temp);
}
}
if(temp == 0 && times < res) {
res = times, ptr = i;
}
}
printf("%d\n", res);
for(int j = 0; j < 16; ++j) {
if((ptr >> j) & 1) {
printf("%d %d\n", j / 4 + 1, j % 4 + 1);
}
}
return 0;
}