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 hujk2008 at 2004-06-16 21:05:47 on Problem 1609
#include<stdio.h>
struct dat
	{
		int a;
		int b;
	};
int pan(struct dat *p1,struct dat *p2)
{
	if((!((p1->a+p2->a)%2))&&(!((p1->a+p2->a)%2)))
	{
		p2->a=0;
		p2->b=0;
		return 1;
	}
	else
		return 0;
}

int main()
{
	struct dat a[10010];
	int n,i,temp1,temp2,j;
	while((scanf("%d",&n))!=EOF){
	if(n==0)
	{
		printf("*\n");
		return 1;
	}
	for(i=1;i<=n;i++)
	{
		scanf("%d%d",&temp1,&temp2);
        if(temp1>temp2)
		{
			a[i].a=temp2;
			a[i].b=temp1;
		}
		else
		{
			a[i].a=temp1;
			a[i].b=temp2;
		}
	}
       temp2=1;
	for(i=1;i<=n;i++)
	{
		temp1=1;
		if(a[i].a==0)continue;
		for(j=i+1;j<=n;j++)
		{
			if(a[j].a==0)continue;
			if(pan(&a[i],&a[j]))
				temp1++;
		}
		if(temp1>temp2)
			temp2=temp1;
	}
	printf("%d\n",temp2);
	}
	return 1;
}

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