• Source
    1. #include<bits/stdc++.h>
    2.  
    3. using namespace std;
    4. int mat[103][103];
    5.  
    6. int main()
    7. {
    8. int n,i,j,counter,counter1,counter2,index,index1;
    9. while(scanf("%d",&n)&&n)
    10. {
    11. counter1=0;
    12. counter2=0;
    13. for(i=1; i<=n; i++)
    14. {
    15. counter=0;
    16. for(j=1; j<=n; j++)
    17. {
    18. scanf("%d",&mat[i][j]);
    19. counter+=mat[i][j];
    20. }
    21. if(counter%2==1)
    22. {
    23. index=i;
    24. counter1++;
    25. }
    26. }
    27. for(j=1; j<=n; j++)
    28. {
    29. counter=0;
    30. for(i=1; i<=n; i++)
    31. {
    32. counter+=mat[i][j];
    33. }
    34. if(counter%2==1)
    35. {
    36. index1=j;
    37. counter2++;
    38. }
    39. }
    40.  
    41. if(counter1==0 && counter2==0)
    42. {
    43. printf("OK\n");
    44. }
    45. else if(counter1>1 || counter2>1)
    46. {
    47. printf("Corrupt\n");
    48. }
    49. else
    50. {
    51. printf("Change bit (%d,%d)\n",index,index1);
    52. }
    53. }
    54. return 0;
    55. }
    56.