Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

水果啊啊啊啊啊啊!!!!!

Posted by wocha at 2012-04-20 18:49:27 on Problem 2260
#include<stdio.h>
#include<stdlib.h>
int main()
{
	int n,m,q,w,e,i,j,s;
	int d[123][122],Row[222],Line[333];
	while(~scanf("%d",&m),m)
	{
		memset(Line,0,sizeof(Line));
  	memset(Row,0,sizeof(Row));
		for(i=1;i<=m;i++)
		 for(j=1;j<=m;j++)

		{
			scanf("%d",&d[i][j]);
      Row[i]+=d[i][j];
			Line[j]+=d[i][j];
	 }
	 int q1=0,q2=0,t1,t2,o=0;
		for(i=1;i<=m;i++)
			{
				if(Row[i]%2==1)
				{
					q1++;
					 if(q1>1)  {printf("Corrupt\n");o++;break;}
					if(q1==1)
					t1=i;
					 
					 
				}
				if(Line[i]%2==1)
				{
          q2++;
          if(q2>1)  {printf("Corrupt\n");o++;break;}
          if(q2==1) 
					t2=i;
					
				}
			}
			if(o!){
			if(q1+q2>=2&&q1!=q2)  printf("Corrupt\n");
			else if(q1*q2==0&&q1!=q2)   printf("Corrupt\n");
			else if(q1+q2==0)  printf("OK\n");
			else if(q1*q2==1)
			{
				printf("Change bit (%d,%d)\n",t1,t2);
			}
		}
	}
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator