Code :
#include<stdio.h>
#define MAX 102
int main()
{
int arr[MAX][MAX],test,i,j,tag,corr1,corr2,m,n,sum;
while(scanf("%d",&test)&&test)
{
corr1 = 0;
corr2 = 0;
tag =0;
for(i=1;i<=test;i++)
{
sum=0;
for(j=1;j<=test;j++)
{
scanf("%d",&arr[i][j]);
sum += arr[i][j];
}
if(sum%2==1)
{
corr1++;
m=i;
}
}
for(i=1;i<=test;i++)
{
sum=0;
for(j=1;j<=test;j++)
{
sum+=arr[j][i];
}
if(sum%2==1)
{
corr2++;
n=i;
}
}
// printf("%d %d\n",corr1,corr2);
if(corr1==0 && corr2==0)
{
printf("OK\n");
}
else if(corr1==1 && corr2==1)
{
printf("Change bit (%d,%d)\n",m,n);
}
else {
printf("Corrupt\n");
}
}
}
No comments:
Post a Comment