-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path541.cpp
More file actions
60 lines (59 loc) · 1.39 KB
/
541.cpp
File metadata and controls
60 lines (59 loc) · 1.39 KB
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
57
58
59
60
#include <bits/stdc++.h>
using namespace std;
int main() {
int i, j, r, count, flag, c, n;
int a[101][101];
while (scanf("%d", &n)) {
r = -1;
c = -1;
flag = 0;
if (n == 0) return 0;
for (i = 0; i < n; i++) {
for (j = 0; j < n; j++) {
scanf("%d", &a[i][j]);
}
}
for (i = 0; i < n; i++) {
count = 0;
for (j = 0; j < n; j++) {
count += a[i][j];
}
if (count % 2 != 0) {
if (r == -1)
r = i + 1;
else {
flag = 1;
break;
}
}
}
if (flag == 1) {
printf("Corrupt\n");
continue;
}
for (i = 0; i < n; i++) {
count = 0;
for (j = 0; j < n; j++) {
count += a[j][i];
}
if (count % 2 != 0) {
if (c == -1)
c = i + 1;
else {
flag = 1;
break;
}
}
}
if (flag == 1) {
printf("Corrupt\n");
continue;
}
if (c == -1 && r == -1) {
printf("OK\n");
} else {
printf("Change bit (%d,%d)\n", r, c);
}
}
return 0;
}