রবিবার, ২৮ আগস্ট, ২০১৬

UVA 541 - Error Correction

///...................SUBHASHIS MOLLICK....................///
///.....DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING....///
///.............ISLAMIC UNIVERSITY,BANGLADESH.............///
///.....................SESSION-(14-15)....................///
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<ctype.h>
#include<bits/stdc++.h>
using namespace std;
main()
{
long int a;
while(scanf("%ld",&a)!=EOF)
{
long int ar[100][100],i,j,k,n,m,sum,count=0,count1=0,sum1;
if(a==0)
break;
for(i=0;i<a;i++)
{
for(j=0;j<a;j++)
{
scanf("%ld",&ar[i][j]);
//printf("%ld",ar[i][j]);
  }
}
for(i=0;i<a;i++)
{
sum=0;
for(j=0;j<a;j++)
{
sum=sum+ar[i][j];

   }
   if(sum%2!=0)
   {
    count++;
   n=i+1;
   }
   //printf("%ld\n",sum);
}
for(j=0;j<a;j++)
{
sum1=0;
for(i=0;i<a;i++)
{
sum1=sum1+ar[i][j];

   }
   if(sum1%2!=0)
   {
    count1++;
m=j+1;
}
   //printf("%ld\n",sum1);

}
if(count==0 && count1==0)
{
printf("OK\n");
}
else if(count==1 && count1==1)
{
printf("Change bit (%ld,%ld)\n",n,m);

}
else
printf("Corrupt\n");
//printf("%ld\n",count);
//printf("%ld\n",count1);
}
}

কোন মন্তব্য নেই:

একটি মন্তব্য পোস্ট করুন

Factory Pattern

Factory Method  is a creational design pattern that provides an interface for creating objects in a superclass but allows subclasses to alte...