#include < stdio.h > #include < string.h > int main() { int n; while (scanf("%d", & n) == 1 && n != 0) { int num1[200][200], i, j, k, l, m = 0, row, col, c1 = 0, c2 = 0; for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { scanf("%d", & num1[i][j]); } } for (i = 0; i < n; i++) { k = 0; for (j = 0; j < n; j++) { k = k + num1[i][j]; } if (k % 2 == 1) { c1++; row = i; } } for (j = 0; j < n; j++) { k = 0; for (i = 0; i < n; i++) { k = k + num1[i][j]; } if (k % 2 == 1) { c2++; col = j; } } if (c1 == 0 && c2 == 0) { printf("OK\n"); } else if (c1 == 1 && c2 == 1) { printf("Change bit (%d,%d)\n", row + 1, col + 1); } else { printf("Corrupt\n"); } } return 0; }
Monday, August 25, 2014
uva : 541 - Error Correction
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment