Advertisement
noshin98

uva 541

Feb 24th, 2017
345
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.87 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int i,j,bit,n,m[200][200],a,b,c,d,e,f;
  5. while(scanf("%d",&n)==1)
  6.     {
  7.     if(n==0)    break;
  8.     for(i=1;i<=n;i++)
  9.         for(j=1;j<=n;j++)
  10.             scanf("%d",&m[i][j]);
  11.    
  12.     e=0;
  13.     f=0;
  14.     for(i=1;i<=n;i++)
  15.         {
  16.         a=0;
  17.         for(j=1;j<=n;j++)
  18.             {
  19.             a=a+m[i][j];
  20.             }
  21.            
  22.         if(a%2!=0)
  23.             {
  24.             c=i;
  25.             e++;
  26.             }  
  27.         }
  28.            
  29.     for(j=1;j<=n;j++)
  30.         {
  31.         b=0;
  32.         for(i=1;i<=n;i++)
  33.             {
  34.             b=b+m[i][j];
  35.             }
  36.         if(b%2!=0)
  37.             {
  38.             d=j;
  39.             f++;
  40.             }
  41.         }
  42.     if(e==0 && f==0)
  43.     printf("OK\n");
  44.     else if(e==1 && f==1)
  45.     printf("Change bit (%d,%d)\n",c,d);
  46.     else
  47.     printf("Corrupt\n");
  48.     }
  49. return 0;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement