ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1792. Hamming Code

wa 8
Posted by garra 9 Jun 2012 11:06
#include<stdio.h>
#include<stdlib.h>



int main()
{
int a[8],i,q1=0,q2=1,q3=2,q4=3,r1=4,r2=5,r3=6;
for(i=0;i<7;i++)
{
scanf("%d",&a[i]);
}

if((a[q2]+a[q3]+a[q4])%2==a[r1]&&(a[q1]+a[q3]+a[q4])%2==a[r2]&&(a[q1]+a[q2]+a[q4])%2==a[r3])
{
for(i=0;i<7;i++)
{
printf("%d",a[i]);
printf(" ");
}
}
else if ((a[q2]+a[q3]+a[q4])%2!=a[r1]&&(a[q1]+a[q3]+a[q4])%2!=a[r2]&&(a[q1]+a[q2]+a[q4])%2==a[r3])
{
if(a[q3]==1)
{
a[q3]=0;
}
else
{
a[q3]=1;
}
for(i=0;i<7;i++)
{
printf("%d",a[i]);
printf(" ");
}
}
else if((a[q2]+a[q3]+a[q4])%2!=a[r1]&&(a[q1]+a[q3]+a[q4])%2==a[r2]&&(a[q1]+a[q2]+a[q4])%2!=a[r3])
{
if(a[q2]==1)
{
a[q2]=0;
}
else
{
a[q2]=1;
}
for(i=0;i<7;i++)
{
printf("%d",a[i]);
printf(" ");
}
}
else if((a[q2]+a[q3]+a[q4])%2==a[r1]&&(a[q1]+a[q3]+a[q4])%2!=a[r2]&&(a[q1]+a[q2]+a[q4])%2!=a[r3])
{
if(a[q1]==0)
{
a[q1]=1;
}
else
{
a[q1]=0;
}
for(i=0;i<7;i++)
{
printf("%d",a[i]);
printf(" ");
}
}
else
{
if(a[q4]==1)
{
a[q4]=0;
}
else
{
a[q4]=1;
}
for(i=0;i<7;i++)
{
printf("%d",a[i]);
printf(" ");
}
}

return 0;
}
Re: wa 8
Posted by Noob 9 Jun 2012 13:19
OH SHI~